Examples

Manage Users via the Application API

150 views 0

Manage Users via the Application API

The users for Developer Console can be managed using API’s from your front-end application.

Such example using the API is presented below.

Create Application User

For creating a user in your Developer Console application, you will need to specify the clientId and clientSecret parameters. You may find these in your Developer Console application settings.
Each new user must have a unique identifier (clientUserId). This may be very well an e-mail address. Additionally, you are required to give a name for your user (clientUserName).

curl -X POST -H "Content-Type: application/json" -d '{
 "clientId": "98_qwltgajrkis0wcw804scksk00cssck8w4wo48oogkwosk8gw8",
 "clientSecret": "27gdxjvgi9z4kc00s0wo8kgo0okg0sw0so0wskgs000swo80os",
 "clientUserId": "john.doe@robofuse.com",
 "clientUserName": "John Doe"
 }' https://developer.robofuse.com/api/v2/app/create-user
HTTP RESPONSE CODE JSON RESPONSE
200 {
“specialToken”:”NTMzY2E5NWU0ZThiYTQ2OGY1NDEyYWE1MTdmMWY2OTEyMTI3MWFiOWNhODEwMDkwYTUwYjcyYTAwYmRjZTFjZg”,
“clientId”:”1_58pwgm81sg00ksogo40og8gcogckcwwoww4sw4owggsw844kgg”,
“clientUserId”:”john.doe@robofuse.com”,
“clientUserName”:”John Doe”
}
400 { “code”: “0001”, “message”: “Cannot assign user to application! Found duplicate unique user identifier (clientUserId).” }
{ “code”: “0004”, “message”: “You did not provide an application client Id! clientId parameter is missing.” }
{ “code”: “0005”, “message”: “You did not provide a client user Id! clientUserId parameter is missing.” }
{ “code”: “0007”, “message”: “You did not provide an application client secret! clientSecret parameter is missing.” }
{ “code”: “0011”, “message”: “Your application is not recognized! Check both clientId and clientSecret.” }
{ “code”: “0012”, “message”: “Your application is not recognized! Check clientId.” }
{ “code”: “0021”, “message”: “Invalid JSON!. Please check that JSON is valid.” }
{ “code”: “0023”, “message”: “You must provide the client user name! clientUserName parameter is missing.” }
{ “code”: “0024”, “message”: “Unable to create user profile. Probably there is an existing profile in API!” }

Get Access Token

Once you have your user created in your Developer Console application, you will need to request an access token.
The access token for the user may be obtained using the specialToken returned by Create Application User. For security purposes the client secret (clientSecret) of your Developer Console application must be specified as well.

curl -X POST -H "Content-Type: application/json" -d '{
 "clientSecret": "98_qwltgajrkis0wcw804scksk00cssck8w4wo48oogkwosk8gw8",
 "specialToken": "NTMzY2E5NWU0ZThiYTQ2OGY1NDEyYWE1MTdmMWY2OTEyMTI3MWFiOWNhODEwMDkwYTUwYjcyYTAwYmRjZTFjZg"
 }' https://developer.robofuse.com/oauth/v2/get-access-token
HTTP RESPONSE CODE JSON RESPONSE
200 {
“ziva_user_code”: “5bee5574-1e7e-4888-aaa5-6754eba2c542”,
“name”: “john doe”,
“email”: “john.doe@robofuse.com”,
“access_token”: “AszY0MjIwOTJkNmM0NjEzNDBmOTg3YmFiZjFmZmNjOWZhNjFmMzMzNDllMTBlOTlkYzJjNzE2YTYxNzRhMj”
}
400 { “code”: “0002”, “message”: “Access token generation failed. Cannot add an access token to the user! Please contact us at RoboFuseSupport.” }
{ “code”: “0006”, “message”: “Your application is not recognized! Check clientSecret and specialToken.” }
{ “code”: “0007”, “message”: “You must provide the application secret (clientSecret parameter is missing)!” }
{ “code”: “0008”, “message”: “Your special toekn (specialToken) is invalid!” }
{ “code”: “0009”, “message”: “OAuth2 token service not reachable at https://developer.robofuse.com/oauth/v2/token. Please contact us at RoboFuse Support.” }
{ “code”: “0010”, “message”: “This method accepts only POST!” }
{ “code”: “0016”, “message”: “You must provide the special Token! specialToken parameter is missing. You may obtain it by calling https://developer.robofuse.com/api/v2/app/create-user.” }

Delete a User

You can see an example below how to delete a user that belongs to an application.

curl -X DELETE https://developer.zivacare.com/api/v2/app/{clientId}/users/{zivaUserCode}
HTTP RESPONSE CODE JSON RESPONSE
204
400 { “code”: “0012”, “message”: “Your application is not recognized! Check clientId.” }
{ “code”: “0025”, “message”: “Your ziva user code is invalid or missing!” }

Was this helpful?

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close