changes.
| User attributes of grid node can be fetched/modified via RESTful API. |
| {note}This feature is available since QuickBuild 5.0.26 {note} |
| h1. Get user attributes of a grid node |
| h2. Syntax |
| User attributes can be fetched by accessing below url: |
| {code}http://localhost:8810/rest/user_attributes/<node address>{code} |
| |
| 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. |
| |
| h2. Security |
| | You will need to use http BASIC authentication to login as user with user attribute retrieval permission to get user attributes of a grid node. |
| | 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. |
| |
| h2. Demo |
| We use [curl|http://curl.haxx.se/] to demonstrate how to get user attributes: |
| # Connect a build agent to your grid and get it authorized. Assume the agent address is _agent1:8811_. |
| # Edit user attributes tab of agent _agent1:8811_ to define some user attributes. |
| # Now run below command: |
| {code}curl -u admin:admin http://<QB server>:8810/rest/user_attributes/agent1:8811{code} |
| # If above command succeeds, XML representation of the user attributes map will be printed. |
| |
| h1. Set user attributes of a grid node |
| h2. Syntax |
| User attributes can be specified by posting XML representation of the user attributes map to below url: |
| {code}http://localhost:8810/rest/user_attributes/<node address>{code} |
| |
| 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: |
| {code} |
| <linked-hash-map> |
| <entry> |
| <string>attribute1</string> |
| <string>value1</string> |
| </entry> |
| <entry> |
| <string>attribute2</string> |
| <string>value2</string> |
| </entry> |
| ... |
| </linked-hash-map> |
| {code} |
| |
| h2. Security |
| You will need to use http BASIC authentication to login as administrator to set user attributes of a grid node. |
| |
| h2. Demo |
| We use [curl|http://curl.haxx.se/] to demonstrate how to set user attributes: |
| # Connect a build agent to your grid and get it authorized. Assume the agent address is _agent1:8811_. |
| # Create a file say "attributes.xml" with below content: |
| {code} |
| <linked-hash-map> |
| <entry> |
| <string>attribute1</string> |
| <string>value1</string> |
| </entry> |
| <entry> |
| <string>attribute2</string> |
| <string>value2</string> |
| </entry> |
| </linked-hash-map> |
| {code} |
| # Now run below command: |
| {code}curl -u admin:admin -X POST -d@attributes.xml http://<QB server>:8810/rest/user_attributes/agent1:8811{code} |
| # If above command succeeds, check user attributes tab of agent1 from QuickBuild web UI to verify if they have been defined correctly. |
| |