Interact with Users

Access user by id

Syntax

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

http://localhost:8810/rest/user?id=<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 rights.

Demo

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

curl -u admin:admin http://localhost:8810/rest/user?id=1

Access user by name

Syntax

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

http://localhost:8810/rest/user?name=<user name>

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 rights.

Demo

Below curl command demonstrates how to get user of name admin:

curl -u admin:admin http://localhost:8810/rest/user?name=admin

Access 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 list of 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 rights.

Demo

Below curl command demonstrates how to get all users:

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

Update user

Syntax

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

http://localhost:8810/rest/user

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 encrypted form. To encrypt password, please access below url:
http://localhost:8810/rest/encrypt?password=<plain password>

Here <plain password> represents for clear text of the password, and 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 modify password of user admin to be 12345:

  1. Retrieve xml representation of user admin into a temp file using below command:
    curl -u admin:admin http://localhost:8810/rest/user?name=admin > tempfile.xml
  2. Encrypt password 12345 using below command:
    curl -u admin:admin http://localhost:8810/rest/encrypt?password=12345
  3. Edit tempfile.xml and change the password property to take encrypted form of password 12345.
  4. Post back modified content using below command:
    curl -X POST -u admin:admin -d @tempfile.xml -u admin:admin http://localhost:8810/rest/user

Create user

Syntax

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

http://localhost:8810/rest/user

Please note that the posted xml should NOT contain the id element; otherwise, QuickBuild will treat the post as an updating 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 id of the newly created user.

The password element in the posted xml should be encrypted form. To encrypt password, please access below url:
http://localhost:8810/rest/encrypt?password=<plain password>

Here <plain password> represents for clear text of the password, and 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. Retrieve xml representation of user admin into a temp file using below command:
    curl -u admin:admin http://localhost:8810/rest/user?name=admin > tempfile.xml
  2. Encrypt password 12345 using below command:
    curl -u admin:admin http://localhost:8810/rest/encrypt?password=12345
  3. Edit tempfile.xml, remove the id element, change the name element to be robin, and change password element to take encrypted form of password 12345.
  4. Post back modified content using below command:
    curl -X POST -u admin:admin -d @tempfile.xml -u admin:admin http://localhost:8810/rest/user

Delete user

Syntax

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

http://localhost:8810/rest/user?id=<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 rights.

Demo

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

curl -X DELETE -u admin:admin http://localhost:8810/rest/user?id=2

Labels:

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