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.
...
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": "password",
"userGroups": [],
"isActive": true,
"email": "email@company.com",
"lastName": "Last",
"firstName": "First",
"localUser": true
} |
When we run a GET request at the following URL
http://host:port/flexdeploy/rest/v2/administration/security/user/10000
The GET request would return the following JSON user object
Code Block | ||||
---|---|---|---|---|
| ||||
{ "userAttributes": [ { "fdUserAttributeId": 10001, "updatedBy": "fdadmin", "createdOn": "2021-09-01T17:23:18.288+0000", "updatedOn": "2021-09-01T17:23:18.288+0000", "versionNumber": 1, "createdBy": "fdadmin" } |
When we run a GET request at the following URL
http://host:port/flexdeploy/rest/v2/administration/security/user/10000
The GET request would return the following JSON 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": "email@company.com", "lastName": "Last", "firstName": "First", "localUser": true, "updatedBy": "fdadmin", "createdOn": "2021-09-01T17:23: true18.288+0000", "updatedOn": "2021-09-01T17:23:18.288+0000", "versionNumber": 1, "createdBy": "fdadmin" } |
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 |
...
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": "password", "userGroups": [], "isActive": true, "email": "employee@company.com", "lastName": "Last", "firstName": "First", "localUser": true, "updatedBy": "fdadmin", "createdOn": "2021-09-01T17:23: true18.288+0000", "updatedOn": "2021-09-01T17:23:18.288+0000", "versionNumber": 1, "createdBy": "fdadmin" } |
When we run a GET request at the following URL
...
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,
"updatedBy": "fdadmin",
"createdOn": "2021-09-01T17:23:18.288+0000",
"updatedOn": "2021-09-01T17:23:18.288+0000",
"versionNumber": 1,
"createdBy": "fdadmin"
}
] |
POST
This POST service will create a new user with the same attributes as the given JSON 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": [ { "groupId": 11001 "userId": 10000 }, { "groupId": 11002 "userId": 10000 } ], "isActive": true, "email": "email@company.com", "lastName": "Last", "firstName": "First", "localUser": true": true, "updatedBy": "fdadmin", "createdOn": "2021-09-01T17:23:18.288+0000", "updatedOn": "2021-09-01T17:23:18.288+0000", "versionNumber": 1, "createdBy": "fdadmin" } |
Example without Groups
If the POST request receives the following JSON 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": "email@company.com",
"lastName": "Last",
"firstName": "First",
"localUser": true,
"updatedBy": "fdadmin",
"createdOn": "2021-09-01T17:23:18.288+0000",
"updatedOn": "2021-09-01T17:23:18.288+0000",
"versionNumber": 1,
"createdBy": "fdadmin"
} |
PUT
This PUT service will update all attributes of a user with the given Id based on the attributes of a JSON object parameters. Attributes that are not provided will become their default values.
...
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": "password", "userGroups": [ { "groupId": 11001 "userId": 10000 } ], "isActive": true, "email": "email@company.com", "lastName": "Last", "firstName": "First", "localUser": true, "updatedBy": "fdadmin", "createdOn": "2021-09-01T17:23:18.288+0000", "updatedOn": "2021-09-01T17:23:18.288+0000", "versionNumber": 1, "createdBy": "fdadmin" } |
When we run a PUT request at the following URL
...
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, "updatedBy": "fdadmin", "createdOn": "2021-09-01T17:23:18.288+0000", "updatedOn": "2021-09-10T06:32:19.147+0000", "versionNumber": 2, "createdBy": "fdadmin" } |
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
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": "password", "userGroups": [ { "groupId": 11001 "userId": 10000 } ], "isActive": true, "email": "email@company.com", "lastName": "Last", "firstName": "First", "localUser": true": true, "updatedBy": "fdadmin", "createdOn": "2021-09-01T17:23:18.288+0000", "updatedOn": "2021-09-01T17:23:18.288+0000", "versionNumber": 1, "createdBy": "fdadmin" } |
When we run a PATCH request at the following URL
...
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": "username",
"password": "*****",
"userGroups": [
{
"groupId": 11001
"userId": 10000
},
{
"groupId": 11002
"userId": 10000
}
],
"isActive": true,
"email": "email@company.com",
"lastName": "Last",
"firstName": "First",
"localUser": true,
"updatedBy": "fdadmin",
"createdOn": "2021-09-01T17:23:18.288+0000",
"updatedOn": "2021-09-10T06:32:19.147+0000",
"versionNumber": 2,
"createdBy": "fdadmin"
} |