Add User

Description

 

The Add User API is designed to facilitate the seamless generation of new users within the system. Serving as a dedicated service, it acts upon invocation to efficiently perform operations, resulting in the creation of a user in uKnowva. This API is a fundamental tool for user management, enhancing the overall functionality and user administration capabilities of the system.

 


API Endpoint

https://Your-uknowva-site-url/api.php/system/uknowva/updateUser

Bearer Token 

 

Please refer to the token generation documentation for generating API tokens to invoke uKnowva APIs. (Token Generation Docs)

 

Method Type

 

  •  POST

Mandatory Fields

“name”,“username”,“email”,“mobile no” 

Example Request


cURL

curl --location 'https://Your-uknowva-site-url/api.php/system/uknowva/updateUser' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer Token' \
--data-raw '{ 
"email": "abc@gmail",
"name": "abc cde",
"username": "testusername",
"password": "12345678", 
"block": "0", 
"designation": "hr", 
"report_manager": "uknowva", 
"mobile_no": "1234567890", 
"adhar_number": "123456987896", 
}'

PHP Code Snippet

<?php
$curl = curl_init(); 
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://Your-uknowva-site-url/api.php/system/uknowva/updateUser',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>'{ 
        "email": "abc@gmail",
        "name": "abc cde",
        "username": "testusername",
        "password": "12345678", 
        "block": "0", 
        "designation": "hr", 
        "report_manager": "uknowva", 
        "mobile_no": "1234567890", 
        "adhar_number": "123456987896", 
    }',
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json',
        'Authorization: Bearer Token',
        'Cookie: 66987f468890f0046c70903896601034=p5dcq26g2niu9tq3gsain9dnd0'
        ),
    )
);
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Python Code Snippet

import requests
import json
url = "https://Your-uknowva-site-url/api.php/system/uknowva/updateUser"
payload = json.dumps({
"email": "abc@gmail",
"name": "abc cde",
"username": "testusername",
"password": "12345678", 
"block": "0", 
"designation": "hr", 
"report_manager": "uknowva", 
"mobile_no": "1234567890", 
"adhar_number": "123456987896", 
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer Token',
  'Cookie': '66987f468890f0046c70903896601034=p5dcq26g2niu9tq3gsain9dnd0'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)

Java Code Snippet

OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{"email": "abc@gmail","name": "abc cde","username": "testusername","password": "12345678", "block": "0", "designation": "hr", "report_manager": "uknowva", "mobile_no": "1234567890", "adhar_number": "123456987896"}");
Request request = new Request.Builder()
.url("https://Your-uknowva-site-url/api.php/system/uknowva/updateUser")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer Token")
.build();
Response response = client.newCall(request).execute();

 


Sample Response


  • Success
{ 
"email": "abc@gmail",
"name": "abc cde",
"username": "testusername",
"password": "12345678", 
"block": "0", 
"designation": "hr", 
"report_manager": "uknowva", 
"mobile_no": "1234567890", 
"adhar_number": "123456987896", 
}
  • Failure
{
"status": true,
"payload": {"status": false,"message": "User name or Email  in use"}
}

{
"status": true,
"payload":{
"status": false,"message": "gender is mandatory"
}
}

 

Sample Collection

Download Add User API Collection

In case you face any problems, then please write to This email address is being protected from spambots. You need JavaScript enabled to view it., our awesome support team will surely help you!

Was this Article helpful?