Users

The following operations can be performed on the users of the Business Directory:

GET /users
GET /users/{userParam}
PUT /users/{userParam}
PUT /users/{userParam}/password
POST /users/{userParam}/roles
DELETE /users/{userParam}/roles
DELETE /users/{userParam}/roles/{role}

GET /users

This API is used to get BD users.

Parameters

Name

Description

Parameter Type

Data Type

domain

Filter by domain.

query

string

userName

Filter by this user name.

query

string

roleFilter

Optional. Filter users by the specified roles.

query

Array[string]

Example to get all users

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/users"

Example to get all users as ldap user with BD_ADMIN rights

curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/ v2/users"

Example to return users that only have BD_ADMIN & MANAGE_CUSTOM_PROPERTIES right

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/users?site=test1& roleFilter=BD_ADMIN&role_filter=MANAGE_CUSTOM_PROPERTIES"

Example to return user information for all users in remote site 'test1'

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/users?domain= test1"

Example to return user information for ldap domains 'ad2003'

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/users?domain=ad2003"

GET /users/{userParam}

This API is used to get a BD user.

Parameters

Name

Description

Parameter Type

Data Type

userParam

User in user@domain format.

path

string

Example to get all users

curl -X GET -u admin:admin "https://localhost:9502/rest/v2/users/admin@composite"

Example to get all users as ldap user with BD_ADMIN rights

curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/users/admin@ldapDomain"

PUT /users/{userParam}

This API is used to update roles or annotation for a BD user. Only the BD Admin can invoke this.

Parameters

Name

Description

Parameter Type

Data Type

userParam

User in user@domain format.

path

string

Request Body

{
  "userName": "string",
  "domain": "string",
  "annotation": "string",
  "roles": [
    "string"
  ]
}

Example to set ldap user 'adenisof' to only have BD_ADMIN and MANAGE_CUSTOM_PROPERTY roles

curl -X PUT -u admin:admin "https://localhost:9502/rest/v2/users/adenisof@ldapDomain" -H "Content-Type:application/json" -d "{ \"roles\" : [ \"BD_ADMIN\", \"MANAGE_CUSTOM_PROPERTIES\" ]}"

Example to remove all roles from ldap user 'adenisof' and update the annotation (as ldap user with BD_ADMIN rights)

curl -X PUT -u user@ldapDomain:password "https://localhost:9502/rest/v2/users/adenisof@ldapDomain" -H "Content-Type:application/json" -d "{ \"annotation\" : \"test new annotation\" }"

Example to remove all roles from ldap user 'adenisof' and update the annotation (X-HTTP-Method-Override)

curl -X POST -u admin:admin "https://localhost:9502/rest/v2/users/adenisof@ldapDomain" -H "X-HTTP-Method-Override:PUT" -H "Content-Type:application/json" -d "{ \"annotation\" : \"test new annotation\" }"

PUT /users/{userParam}/password

This API is used to change the password for a BD user. Only the BD Admin can invoke this

Parameters

Name

Description

Parameter Type

Data Type

userParam

User in user@domain format.

path

string

Request Body

{
  "oldPassword": "string",
  "newPassword": "string"
}

Example to update password for user 'admin'

curl -X PUT -u admin:admin "https://localhost:9502/rest/v2/users/admin@composite/password" -H "Content-Type:application/json" -d "{ \"oldPassword\" : \"admin\", \"newPassword\" : \"admin2\" }"

Example to update password for user 'admin' (X-HTTP-Method-Override)

curl -X POST -u admin:admin "https://localhost:9502/rest/v2/users/admin@composite/password" -H "X-HTTP-Method-Override:PUT" -H "Content-Type:application/json" -d "{ \"oldPassword\" : \"admin\", \"newPassword\" : \"admin2\" }"

POST /users/{userParam}/roles

This API is used to add roles to a BD user. Only the BD Admin can invoke this

Parameters

Name

Description

Parameter Type

Data Type

userParam

User in user@domain format.

path

string

Request Body

{
  "Roles": [
    "string"
  ]
}

Example to add BD_ADMIN and MANAGE_CUSTOM_PROPERTY to ldap user 'adenisof'

curl -X POST -u admin:admin "https://localhost:9502/rest/v2/users/adenisof@ldapDomain/roles" -H "Content-Type:application/json" -d "{ \"roles\" : [ \"BD_ADMIN\", \"MANAGE_CUSTOM_PROPERTIES\" ]}"

Example to add BD_ADMIN and MANAGE_CUSTOM_PROPERTY to ldap user 'adenisof' (as ldap user with BD_ADMIN rights)

curl -X POST -u user@ldapDomain:password "https://localhost:9502/rest/v2/users/adenisof@ldapDomain/roles" -H "Content-Type:application/json" -d "{ \"roles\" : [ \"BD_ADMIN\", \"MANAGE_CUSTOM_PROPERTIES\" ]}"

DELETE /users/{userParam}/roles

This API is used to remove all roles from a BD user. Only the BD Admin can invoke this

Parameters

Name

Description

Parameter Type

Data Type

userParam

User in user@domain format.

path

string

Example to remove all roles from ldap user 'adenisof'

curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/users/adenisof@ldapDomain/roles"

Example to remove all roles from ldap user 'adenisof' (as ldap user with BD_ADMIN rights)

curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/users/adenisof@ldapDomain/roles"

Example to remove all roles from ldap user 'adenisof' (X-HTTP-Method-Override)

curl -X POST -u admin:admin "https://localhost:9502/rest/v2/users/adenisof@my_bd_ldap_domain/roles" -H "X-HTTP-Method-Override:DELETE" 

DELETE /users/{userParam}/roles/{role}

This API is used to remove a role from a BD user. Only the BD Admin can invoke this

Parameters

Name

Description

Parameter Type

Data Type

userParam

User in user@domain format.

path

string

role

Role to remove.

path

string

Example to remove all roles from ldap user 'adenisof'

curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/users/adenisof@ldapDomain/roles/BD_ADMIN"

Example to remove BD_ADMIN role from ldap user 'adenisof' (as ldap user with BD_ADMIN rights)

curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/users/adenisof@ldapDomain/roles/BD_ADMIN"

Example to remove BD_ADMIN role from ldap user 'adenisof' (X-HTTP-Method-Override)

curl -X POST -u admin:admin "https://localhost:9502/rest/v2/users/adenisof@ldapDomain/roles/BD_ADMIN" -H "X-HTTP-Method-Override:DELETE"