User API v2

User API v2

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

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/v2/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 Codes

HTTP Code

Description

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
{ "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, "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

User - 10000
{ "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" }

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/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

Request

Attributes

Type

Required

Description

Attributes

Type

Required

Description

userId

Query - Long

No

Equals search

userName

Query - String

No

Contains ignore case search

firstName

Query - String

No

Contains ignore case search

lastName

Query - String

No

Contains ignore case search

email

Query - String

No

Contains ignore case search

isActive

Query - Boolean

No

Equals search

localUser

Query - Boolean

No

Equals search

Response Codes

HTTP Code

Description

HTTP Code

Description

200

Search successful and results returned

400

Bad request

401

Authentication failure

403

Authorization failure (no access to resource)

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
{ "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: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?userName=user&isActive=true&email=employee

The GET request would return the  following JSON user object

User - 10000
[ { "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.

Request

Attributes

Type

Required

Description

userAttributes

List<UserAttribute>

No

The list of attributes associated with the user. They will be defaulted if not provided

userName

String

Yes

The user name of the user

password

String

Yes

The user's password. Note: this value is displayed as "*****" when retrieved.

userGroups

List<UserGroup>

No

Provide list of groups that user should be member of.

localUser

Boolean

No

Whether or not the user was made in FlexDeploy. Set to true upon creation.

isActive

Boolean

No

Whether or not the user is active. Defaulted to true if not provided.

email

String

Yes

The user's email

firstName

String

Yes

The first name of the user

lastName

String

Yes

The last name of the user

Response Codes

HTTP Code

Description

HTTP Code

Description

201

User was created

400

Bad request

401

Authentication failure

403

Authorization failure (no access to resource)

500

Unexpected internal server error

Example with Groups

If the POST request receives the following JSON user object,

User - 10000
{ "userName": "username", "password": "password", "email": "email@company.com", "lastName": "Last", "firstName": "First", "userGroups": [ { "groupId": 11001 }, { "groupId": 11002 } ] }

The following user object will then be created as a new row in the database.

User - 10000
{ "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, "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,

User - 10000
{ "userName": "username", "password": "password", "email": "email@company.com", "lastName": "Last", "firstName": "First" }

The following user object will then be created as a new row in the database.

User - 10000
{ "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.

Request

Attributes

Type

Required

Description

Attributes

Type

Required

Description

Id

URL

Yes

The PUT will be performed on the user with the specified id that is found in the URL.

userAttributes

List<UserAttribute>

No

The list of attributes associated with the user. They will be defaulted if not provided

userName

String

Yes

The user name of the user

password

String

Yes

The user's password. Note: this value is displayed as "*****" when retrieved.

userGroups

List<UserGroup>

No

Provide list of groups that user should be member of. If user is already member of some group that is not part of input request, user will be removed from that group's membership.

localUser

Boolean

No

Whether or not the user was made in FlexDeploy. Cannot be changed.

isActive

Boolean

No

Whether or not the user is active. Defaulted to true if not provided.

email

String

Yes

The user's email

firstName

String

Yes

The first name of the user

lastName

String

Yes

The last name of the user

Response Codes

HTTP Code

Description

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 a user in our database with an Id of 10000 and had the following attributes

User - 10000
{ "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

http://host:port/flexdeploy/rest/v2/administration/security/user/10000

And the PUT request receives the following JSON user object,

User - 10000
{ "userAttributes": [ { "fdUserAttrDefId": 11478, "attributeValue": "false" } ], "userName": "newusername", "password": "password", "userGroups": [ { "groupId": 11002 } ], "isActive": true, "email": "newemail@company.com", "lastName": "Lastname", "firstName": "Firstname" }

The PUT request would then update the user with Id 10000 and return the  following JSON user object

User - 10000
{ "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.

Request

Attributes

Type

Required

Description

Id

URL

Yes

The PUT will be performed on the user with the specified id that is found in the URL.

userAttributes

List<UserAttribute>

No

The list of attributes associated with the user. Only provided attributes will be changed.

userName

String

No

The user name of the user

password

String

No

The user's password. Note: this value is displayed as "*****" when retrieved.

userGroups

List<UserGroup>

No

Provide list of groups that user should be made member of. Already existing membership is not updated. This is only additional membership.

localUser

Boolean

No

Whether or not the user was made in FlexDeploy.

isActive

Boolean

No

Whether or not the user is active.

email

String

No

The user's email

firstName

String

No

The first name of the user

lastName

String

No

The last name of the user

Response Codes

HTTP Code

Description

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 user in our database with an Id of 10000 and had the following attributes

User - 10000
{ "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 PATCH request at the following URL

The following macros are not currently supported in the footer:
  • style