User API
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.
Authentication - Use Basic Authentication for this API.
GET
There are two implementations of GET. One will find a user with the given Id and return the JSON representation of the user . The other will find a list of users matching the parameters supplied to it.
GET by ID
This GET service will find a user with the given Id and return the JSON representation of the object.
API URL
http://host:port/flexdeploy/rest/v1/administration/security/user/{Id}
Request
Parameter | Type | Required | Description |
|---|---|---|---|
Id | URL | Yes | This is a URL parameter for the Id which is used to find and return a user |
Response
| Attributes | Type | Description |
|---|---|---|
| userId | Long | The id of the user |
| attributes | List<Attribute> | The list of attributes associated with the user |
| userName | String | The user name of the user |
| password | String | The user's password. Note: this value is displayed as "*****" when retrieved. |
| groups | List<Long> | The ids of the groups that the user is a member of |
| isLocalUser | Boolean | Whether or not the user was made in FlexDeploy or imported from outside |
| isActive | Boolean | Whether or not the user is active |
| String | The user's email | |
| firstName | String | The first name of the user |
| lastName | String | The last name of the user |
Each attribute in the list of attributes contains these attributes.
| Attributes | Type | Description |
|---|---|---|
| description | String | The description of the attribute |
| attributeName | String | The name of the attribute |
| attributeValue | String | The value of the attribute |
| attributeGroup | String | The group that the attribute is associated with |
| attributeDataType | String | The type of data that the value is |
Response Codes
HTTP Code | Description |
|---|---|
200 | User was found and returned |
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 a user in our database with an Id of 10000 and had the following attributes
User - 10000
{
"attributes": [
{
"description": "Notify on Approval Required",
"attributeName": "SUBMITTER_PENDING_APPROVAL",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Scheduled",
"attributeName": "SUBMITTER_SCHEDULED",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Failed",
"attributeName": "SUBMITTER_FAILED",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Deploying",
"attributeName": "SUBMITTER_READY",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Completed",
"attributeName": "SUBMITTER_COMPLETED",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Rejected",
"attributeName": "SUBMITTER_REJECTED",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
}
],
"userId": 10000,
"userName": "username",
"password": "password",
"groups": [10010,10011],
"isActive": true,
"email": "email@company.com",
"lastName": "Last",
"firstName": "First",
"isLocalUser": true
}When we run a GET request at the following URL
http://host:port/flexdeploy/rest/v1/administration/security/user/10000
The GET request would return the following JSON user object
User - 10000
{
"attributes": [
{
"description": "Notify on Approval Required",
"attributeName": "SUBMITTER_PENDING_APPROVAL",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Scheduled",
"attributeName": "SUBMITTER_SCHEDULED",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Failed",
"attributeName": "SUBMITTER_FAILED",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Deploying",
"attributeName": "SUBMITTER_READY",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Completed",
"attributeName": "SUBMITTER_COMPLETED",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
},
{
"description": "Notify on Request Rejected",
"attributeName": "SUBMITTER_REJECTED",
"attributeValue": "true",
"attributeGroup": "EMAIL_COMMUNICATION",
"attributeDataType": "Boolean"
}
],
"userId": 10000,
"userName": "username",
"password": "*****",
"groups": [10010,10011],
"isActive": true,
"email": "email@company.com",
"lastName": "Last",
"firstName": "First",
"isLocalUser": true
}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.
API URLs
http://host:port/flexdeploy/rest/v1/administration/security/user?
Append the following character sequences to the above URL to specify Query parameters.
Use '&' between successive query parameters:
userName={userName}
firstName={firstName} *
lastName={lastName} *
groupId={groupId}
Examples:
To search by user name only:
http://host:port/flexdeploy/rest/v1/administration/security/user?userName=fdadmin
To search by first name and last name:
http://host:port/flexdeploy/rest/v1/administration/security/user?firstName=John&lastName=Smith
To search by group id
http://host:port/flexdeploy/rest/v1/administration/security/user?groupId=11101
* searching by first and last name returns all users that contain the specified string in their first or last name
Request
Attributes | Type | Required | Description |
|---|---|---|---|
groupId | Query - Long | No | Find users that are member of specific group |
userName | Query - String | No | Equals search |
firstName | Query - String | No | Contains ignore case search |
lastName | Query - String | No | Contains ignore case search |