Users can be accessed and modified through this API using four services: GET, POST, PUT, and PATCH. These four services allow for the retrieval, creation, complete update, and partial update of users.
...
GET (Using Query Parameters)
This GET service will return a list of users in the form of JSON objects based on the query parameters user name, first name, last name and group id. Users are only returned if they match all of the specified query parameters. If no query parameters are given this request will return the entire list of users.
Info | ||
---|---|---|
| ||
http://host:port/flexdeploy/rest/v2/administration/security/user? Append the following character sequences to the above URL to specify Query parameters.Use '&' between successive query parameters:userId={id} userName={userName} firstName={firstName} lastName={lastName} email={email} isActive={boolean} localUser={boolean} Examples:To search by user name only:http://host:port/flexdeploy/rest/v2/administration/security/user?userName=fdadmin To search by first name and last name:http://host:port/flexdeploy/rest/v2/administration/security/user?firstName=John&lastName=Smith |
...
The GET request would return the following JSON environment user object
Code Block | ||||
---|---|---|---|---|
| ||||
[ { "userAttributes": [ { "fdUserAttributeId": 10001, "userId": 10000, "fdUserAttrDefId": 11478, "attributeValue": "true" }, { "fdUserAttributeId": 10002, "userId": 10000, "fdUserAttrDefId": 11479, "attributeValue": "true" }, { "fdUserAttributeId": 10003, "userId": 10000, "fdUserAttrDefId": 11490, "attributeValue": "true" }, { "fdUserAttributeId": 10004, "userId": 10000, "fdUserAttrDefId": 11491, "attributeValue": "true" }, { "fdUserAttributeId": 10005, "userId": 10000, "fdUserAttrDefId": 11492, "attributeValue": "true" }, { "fdUserAttributeId": 10006, "userId": 10000, "fdUserAttrDefId": 11493, "attributeValue": "true" }, { "fdUserAttributeId": 10007, "userId": 10000, "fdUserAttrDefId": 11494, "attributeValue": null } ], "userId": 10000, "userName": "username", "password": "*****", "userGroups": [], "isActive": true, "email": "employee@company.com", "lastName": "Last", "firstName": "First", "localUser": true } ] |
...
The PUT request would then update the environment user with Id 10000 and return the following JSON environment user object
Code Block | ||||
---|---|---|---|---|
| ||||
{ "userAttributes": [ { "fdUserAttributeId": 10001, "userId": 10000, "fdUserAttrDefId": 11478, "attributeValue": "false" }, { "fdUserAttributeId": 10002, "userId": 10000, "fdUserAttrDefId": 11479, "attributeValue": "true" }, { "fdUserAttributeId": 10003, "userId": 10000, "fdUserAttrDefId": 11490, "attributeValue": "true" }, { "fdUserAttributeId": 10004, "userId": 10000, "fdUserAttrDefId": 11491, "attributeValue": "true" }, { "fdUserAttributeId": 10005, "userId": 10000, "fdUserAttrDefId": 11492, "attributeValue": "true" }, { "fdUserAttributeId": 10006, "userId": 10000, "fdUserAttrDefId": 11493, "attributeValue": "true" }, { "fdUserAttributeId": 10007, "userId": 10000, "fdUserAttrDefId": 11494, "attributeValue": null } ], "userId": 10000, "userName": "newusername", "password": "*****", "userGroups": [ { "groupId": 11002 "userId": 10000 } ], "isActive": true, "email": "newemail@company.com", "lastName": "Lastname", "firstName": "Firstname", "localUser": true } |
PATCH
This PATCH service will update an existing user with the information passed through a JSON object. If an attribute of the JSON is null it will not be updated in the user. Groups that are included in a PATCH will be added, but existing groups will still remain.
Info | ||
---|---|---|
| ||
http://host:port/flexdeploy/rest/v2/administration/security/user/{Id} |
...
HTTP Code | Description |
---|---|
200 | User was found and updated |
400 | Bad request |
401 | Authentication failure |
403 | Authorization failure (no access to resource) |
404 | User not found |
500 | Unexpected internal server error |
Example
If we had an environment user in our database with an Id of 10000 and had the following attributes
...