CREATE or UPDATE Users with Rest API

note_awesome

LIMITATION

You can create or update only 1 user in a Rest call.

All the following examples assume that the base URL for the Reporting API is: http://<WebApp URL>/restapi

Supported Operations for User Management

For the Task of ...

Use the following REST call (URL)

To create new User records

CALL Type: POST

URL:

http://<WebApp URL>/restapi/component/user

JSON Payload (example):

In the payload, include all the fields and values which need to be updated, for example:

{

"username": "demo",

"fullname": "Demo User",

"emailaddress": "demo@sai360.com",

"userdescription": "Demo User",

"password": "Demo123",

"activeaccountflag": true,

"temporarydisabledflag": false,

"domains": null,

"logintype": "Manual",

"timezone": null,

"dashboard": "Home (Simple)",

"locality": null,

"roles": [

"System Role - ALL USERS",

"User Role - Action - General"

],

"forceuserpasswordreset": false

}

 

To update existing User

CALL Type: PATCH

URL:

http://<WebApp URL>/restapi/component/user('UniqueID_of_User')

JSON Payload (example):

In the payload, include all the fields and values which need to be updated, for example:

{

"username": "demo",

"fullname": "Demo User",

"emailaddress": "demo@sai360.com",

"userdescription": "Demo User",

"password": "Demo123",

"activeaccountflag": true,

"temporarydisabledflag": false,

"domains": null,

"logintype": "Manual",

"timezone": null,

"dashboard": "Home (Simple)",

"locality": null,

"roles": [

"System Role - ALL USERS",

"User Role - Action - General"

],

"forceuserpasswordreset": false

}

 

NOTES:

If the number of Roles in the payload

  • is 1:
    the update will be append the new role to the existing list of roles
  • is more than 1:
    the existing list of roles will be replaced with the new list of roles

 

To clear the roles, use the following in the payload:

{

"roles":[]
}

See Also

Rest API

Rest API - Introduction

Add Components to Rest API

Generate an API Key for a User

GET (Read) Operations

PATCH (Write) Operations

POST (Create) Operations

CREATE DBFiles/Files with Rest API