Interact with Configurations

Version 4 by Robin Shen
on Jun 13, 2010 06:02.


compared with
Current by Robin Shen
on Jul 21, 2010 03:58.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 3 changes. View first change.

 h1. Get child configurations of specified configuration
  
 h2. Syntax
 A list of child configurations can be accessed by parent configuration id using http GET method through below url:
 {code}http://localhost:8810/rest/configurations?parent_id=<parent configuration id>{code}
 Here _<parent configuration id>_ represents id of the parent configuration. The response is of mime type _application/xml_ and the content is brief xml representation of list of all child configurations.
 {note}For performance reason, only brief information of the configuration will be returned here, including id, name, description, schedule, runMode, errorMessage, and parent id. You may [get the full xml representation using id|#get configuration by id] if necessary.{note}
  
 h2. Security
 You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access any of the returned configuration.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get child configurations under the configuration with id of _1_:
 {code}curl -u admin:admin http://localhost:8810/rest/configurations?parent_id=1{code}
  
 h1. Get all descendent configurations of specified configuration
  
 h2. Syntax
 All descendent configurations can be accessed by parent configuration id using http GET method through below url:
 {code}http://localhost:8810/rest/configurations?parent_id=<parent configuration id>&recursive=true{code}
 Here _<parent configuration id>_ represents id of the parent configuration. The response is of mime type _application/xml_ and the content is brief xml representation of list of all descendent configurations.
 {note}For performance reason, only brief information of the configuration will be returned here, including id, name, description, schedule, runMode, errorMessage, and parent id. You may [get the full xml representation using id|#get configuration by id] if necessary.{note}
  
 h2. Security
 You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access any of the returned configuration.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get descendent configurations under the configuration with id of _1_:
 {code}curl -u admin:admin "http://localhost:8810/rest/configurations?id=1&recursive=true"{code}
  
 h1. Get all configurations in the system
  
 h2. Syntax
 All configurations in the system can be accessed using http GET method through below url:
 {code}http://localhost:8810/rest/configurations?recursive=true{code}
 The response is of mime type _application/xml_ and the content is brief xml representation of list of all configurations.
 {note}For performance reason, only brief information of the configuration will be returned here, including id, name, description, schedule, runMode, errorMessage, and parent id. You may [get the full xml representation using id|#get configuration by id] if necessary.{note}
  
 h2. Security
 You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access any of the returned configuration.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get descendent configurations under the configuration with id of _1_:
 {code}curl -u admin:admin "http://localhost:8810/rest/configurations?recursive=true"{code}
  
 {anchor:get configuration by id}
 h1. Access configuration by id
  
 h2. Syntax
 Configuration can be accessed by id using http GET method through below url:
 {code}http://qb-server:8810/rest/configurations/<configuration id>{code}
 Here _<configuration id>_ stands for id of the configuration. The response is of mime type _application/xml_ and the content is xml representation of the configuration.
  
 h2. Security
 You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have the _ACCESS_SETTINGS_ permission of the requested configuration.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get xml representation of configuration with identifier _1_ (the root configuration):
 {code}curl -u admin:admin http://localhost:8810/rest/configurations/1{code}
  
 h1. Access configuration path by id
  
 h2. Syntax
 Configuration path can be accessed by id using http GET method through below url:
 {code}http://localhost:8810/rest/configurations/<configuration id>/path{code}
 Here _<configuration id>_ stands for id of the configuration. The response is of mime type _plain/text_ and the content is string representation of the configuration path name.
  
 h2. Security
 Any user can access this service including anonymous.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get path name of configuration with id _2_:
 {code}curl http://localhost:8810/rest/configurations/2/path{code}
  
 h1. Access configuration name by id
  
 h2. Syntax
 Configuration name can be accessed by id using http GET method through below url:
 {code}http://localhost:8810/rest/configurations/<configuration id>/name{code}
 Here _<configuration id>_ stands for id of the configuration. The response is of mime type _plain/text_ and the content is string representation of the configuration name.
  
 h2. Security
 You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous is not allowed to access the requested configuration.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get name of configuration with id _2_:
 {code}curl -u admin:admin http://localhost:8810/rest/configurations/2/name{code}
  
 h1. Access configuration description by id
  
 h2. Syntax
 Configuration description can be accessed by id using http GET method through below url:
 {code}http://localhost:8810/rest/configurations/<configuration id>/description{code}
 Here _<configuration id>_ stands for id of the configuration. The response is of mime type _plain/text_ and the content is string representation of the configuration description. Status code 204 (No Content) will be returned if the configuration does not have description.
  
 h2. Security
 You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous is not allowed to access the requested configuration.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get description of configuration with id _2_:
 {code}curl -u admin:admin http://localhost:8810/rest/configurations/2/description{code}
  
 h1. Access configuration error message by id
  
 h2. Syntax
 Configuration error message can be accessed by id using http GET method through below url:
 {code}http://localhost:8810/rest/configurations/<configuration id>/error_message{code}
 Here _<configuration id>_ stands for id of the configuration. The response is of mime type _plain/text_ and the content is string representation of the configuration error message. Status code 204 (No Content) will be returned if the configuration is not in error.
  
 h2. Security
 You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous is not allowed to access the requested configuration.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get error message of configuration with id _2_:
 {code}curl -u admin:admin http://localhost:8810/rest/configurations/2/error_message{code}
  
 h1. Access configuration run mode by id
  
 h2. Syntax
 Configuration run mode can be accessed by id using http GET method through below url:
 {code}http://localhost:8810/rest/configurations/<configuration id>/run_mode{code}
 Here _<configuration id>_ stands for id of the configuration. The response is of mime type _plain/text_ and the content is string representation of configuration run mode. Status code 204 (No Content) will be returned if run mode is inherited from parent configuration.
  
 h2. Security
 Any user can access this service including anonymous.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get run mode of configuration with id _2_:
 {code}curl http://localhost:8810/rest/configurations/2/run_mode{code}
  
 h1. Access configuration schedule by id
  
 h2. Syntax
 Configuration schedule can be accessed by id using http GET method through below url:
 {code}http://localhost:8810/rest/configurations/<configuration id>/schedule{code}
 Here _<configuration id>_ stands for id of the configuration. The response is of mime type _application/xml_ and the content is XML representation of configuration schedule. Status code 204 (No Content) will be returned if schedule is inherited from parent configuration.
  
 h2. Security
 Any user can access this service including anonymous.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get schedule of configuration with id _2_:
 {code}curl http://localhost:8810/rest/configurations/2/schedule{code}
  
 h1. Access parent configuration by id
  
 h2. Syntax
 Parent configuration can be accessed by id using http GET method through below url:
 {code}http://localhost:8810/rest/configurations/<configuration id>/parent{code}
 Here _<configuration id>_ stands for id of the configuration. The response is of mime type _plain/text_ and the content is string representation of id of parent configuration. Status code 204 (No Content) will be returned if the configuration is root configuration and does not have parent.
  
 h2. Security
 Any user can access this service including anonymous.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to get parent of configuration with id _2_:
 {code}curl http://localhost:8810/rest/configurations/2/parent{code}
  
 h1. Update configuration
  
 h2. Syntax
 Configuration can be updated by posting xml representation of the configuration to below url:
 {code}http://localhost:8810/rest/configurations{code}
 Please note that the _parent_ element denotes id of the parent configuration.
 Normally you do not need to create the xml from scratch: you may retrieve full xml representation of the configuration using configuration id, 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 configuration id being updated.
  
 h2. Security
 You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.
  You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have _EDIT_SETTINGS_ permission on the requested configuration.
  
 h2. Demo
 We will use [curl|http://curl.haxx.se/] to demonstrate how to modify description of configuration _root/test_:
 # Retrieve id of configuration _root/test_ [using id service|retrieve object identifier]:
 {code}curl http://localhost:8810/rest/ids?configuration_path=root/test{code}
 # Retrieve full xml representation of configuration _root/test_ into a temp file using below command:
 {code}curl -u admin:admin http://localhost:8810/rest/configurations/<configuration id> > tempfile.xml{code}
 Here _<configuration id>_ needs to be replaced with query result of first step.
 # Edit _tempfile.xml_ and change the _description_ property to desired value (or add description element if it does not exist).
 # Post back modified content using below command:
 {code}curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/configurations{code}
  
 h1. Create configuration
  
 h2. Syntax
 Configuration can be created by posting xml representation of the configuration to below url:
 {code}http://localhost:8810/rest/configurations{code}
 Please note that:
 # The posted xml should NOT contain the _id_ element; otherwise, QuickBuild will treat the post as an update to the configuration with that id.
 # The _parent_ element denotes id of the parent configuration.
 Normally you do not need to create the xml from scratch: you may retrieve xml representation of a templating configuration using various configuration access methods, 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 configuration.
  
 h2. Security
You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.
  You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have _ADD_CHILDREN_ permission on the parent configuration.
  
 h2. Demo
 We will use [curl|http://curl.haxx.se/] to demonstrate how to create a new configuration _root/test-copy_ by copying the configuration _root/test_.
 # Retrieve id of configuration _root/test_ [using id service|retrieve object identifier]:
 {code}curl http://localhost:8810/rest/ids?configuration_path=root/test{code}
 # Retrieve full xml representation of configuration _root/test_ into a temp file using below command:
 {code}curl -u admin:admin http://localhost:8810/rest/configurations/<configuration id> > tempfile.xml{code}
 Here _<configuration id>_ needs to be replaced with query result of first step.
 # Edit _tempfile.xml_, remove the _id_ element, and change the _name_ element to be _test-copy_
 # Post back modified content using below command:
 {code}curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/configurations{code}
  
 h1. Delete configuration
  
 h2. Syntax
 Configuration can be deleted using http DELETE method through below url:
 {code}http://localhost:8810/rest/configurations/<configuration id>{code}
 Here _<configuration id>_ stands for id of the configuration to be deleted and can be queried with [id service|retrieve object identifier].
  
 h2. Security
 You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.
  You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have _DELETE_CHILDREN_ on the parent configuration.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to delete the configuration with id _2_:
 {code}curl -X DELETE -u admin:admin http://localhost:8810/rest/configurations/2{code}