Interact with Users

Get all users in the system

Syntax

Users in the system can be accessed using http GET method through below url:

http://localhost:8810/rest/users

The response is of mime type application/xml and the content is XML representation of all users in the system.

Security

You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have adminstrative right.

Demo

Below curl command demonstrates how to get all users:

curl -u admin:admin http://localhost:8810/rest/users

Access user by id

Syntax

User can be accessed by id using http GET method through below url:

http://localhost:8810/rest/users/<user id>

The response is of mime type application/xml and the content is XML representation of the user.

Security

You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have adminstrative right.

Demo

Below curl command demonstrates how to get user of id 1:

curl -u admin:admin http://localhost:8810/rest/users/1

Get user display name by id

Syntax

User display name can be accessed by id using http GET method through below url:

http://localhost:8810/rest/users/<user id>/display_name

The response is of mime type text/plain and the content is string representation of the user.

Security

You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have adminstrative right.

Demo

Below curl command demonstrates how to get display name of user with id 1:

curl -u admin:admin http://localhost:8810/rest/users/1/display_name

Update user

Syntax

User can be updated by posting XML representation of the user to below url:

http://localhost:8810/rest/users

Normally you do not need to create the xml from scratch: you may retrieve XML representation of the user using http GET method, modify certain parts of the XML and post back to above url.
The response is of mime type text/plain and the content is string representation of the user id being updated.

The password element in the posted xml should be in encrypted form. To encrypt password, please post password to be encrypted to below url:
http://localhost:8810/encrypt

The response is of mime type plain/text and the content is encrypted form of the password.

Security

You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative right.

Demo

We will use curl to demonstrate how to modify password of user robin to be 12345:

  1. Retrieve id of user robin using id service:
    curl http://localhost:8810/rest/ids?user_name=robin

    Assume returned id is 2.

  2. Retrieve XML representation of user robin into a temp file using below command:
    curl -u admin:admin http://localhost:8810/rest/users/2 > tempfile.xml
  3. Encrypt password 12345 using below command:
    curl -X POST -d 12345 http://localhost:8810/encrypt
  4. Edit tempfile.xml and change the password property to use value returned by step 3.
  5. Post back modified content using below command:
    curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/users

Create user

Syntax

User can be created by posting XML representation of the user to below url:

http://localhost:8810/rest/users

Please note that the posted XML should NOT contain the id element; otherwise, QuickBuild will treat the post as an update to the user with that id.
Normally you do not need to create the XML from scratch: you may retrieve XML representation of a templating user using http GET method, remove the id element, modify certain parts and post back to above url.
The response is of mime type text/plain and the content is string representation of the newly created user id.

The password element in the posted xml should be encrypted form. To encrypt password, please post password to be encrypted to below url:
http://localhost:8810/encrypt

The response is of mime type plain/text and the content is encrypted form of the password.

Security

You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.

Demo

We will use curl to demonstrate how to create a new user robin by copying the existing user admin, and change the password to 12345.

  1. Get id of user admin with id service
    curl http://localhost/rest/ids?user_name=admin

    Assume returned id is 1.

  2. Retrieve XML representation of user admin into a temp file using below command:
    curl -u admin:admin http://localhost:8810/rest/users/1 > tempfile.xml
  3. Encrypt password 12345 using below command:
    curl -X POST -d 12345 http://localhost:8810/encrypt
  4. Edit tempfile.xml, remove the id element, change the name element to be robin, and change password element to use value returned by step 3.
  5. Post back modified content using below command:
    curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/users

Delete user

Syntax

User can be deleted using http DELETE method through below url:

http://localhost:8810/rest/users/<user id>

Here <user id} stands for id of the user to be deleted.

Security

You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative right.

Demo

Below curl command demonstrates how to delete the user with id 2:

curl -X DELETE -u admin:admin http://localhost:8810/rest/users/2

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.