Skip to main content
Version: QB14

Get and Set User Attributes of Grid Node

User attributes of grid node can be fetched/modified via RESTful API.

warning

This feature is available since QuickBuild 5.0.26

Get user attributes of a grid node​

Syntax​

User attributes can be fetched by accessing below url:

http://localhost:8810/rest/user_attributes/<node address>

Here <node address> should be replaced with address of the grid node, for instance: agent:8811 . The response is of mime type text/xml and the content is XML representation of defined user attributes for specified grid node.

Security​

You will need to use http BASIC authentication to login as user with node attribute access permission to get user attributes of a grid node.

Demo​

We use curl to demonstrate how to get user attributes:

  1. Connect a build agent to your grid and get it authorized. Assume the agent address is agent1:8811.

  2. Edit user attributes tab of agent agent1:8811 to define some user attributes.

  3. Now run below command:

    curl -u admin:admin http://<QB server>:8810/rest/user_attributes/agent1:8811
  4. If above command succeeds, XML representation of the user attributes map will be printed.

Set user attributes of a grid node​

Syntax​

User attributes can be specified by posting XML representation of the user attributes map to below url:

http://localhost:8810/rest/user_attributes/<node address>

Here <node address> should be replaced with address of the grid node, for instance: agent:8811. XML representation of user attributes map should follow below format:

<linked-hash-map>
<entry>
<string>attribute1</string>
<string>value1</string>
</entry>
<entry>
<string>attribute2</string>
<string>value2</string>
</entry>
...
</linked-hash-map>

Security​

You will need to use http BASIC authentication to login as administrator to set user attributes of a grid node.

Demo​

We use curl to demonstrate how to set user attributes:

  1. Connect a build agent to your grid and get it authorized. Assume the agent address is agent1:8811.

  2. Create a file say "attributes.xml" with below content:

    <linked-hash-map>
    <entry>
    <string>attribute1</string>
    <string>value1</string>
    </entry>
    <entry>
    <string>attribute2</string>
    <string>value2</string>
    </entry>
    </linked-hash-map>
  3. Now run below command:

    curl -u admin:admin -X POST -d@attributes.xml http://<QB server>:8810/rest/user_attributes/agent1:8811
  4. If above command succeeds, check user attributes tab of agent1 from QuickBuild web UI to verify if they have been defined correctly.