Skip to main content
Version: QB90

Interact with Configuration Authorizations

Get all authorizations in the system

Syntax

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

http://localhost:8810/rest/authorizations

The response is of mime type application/xml and the content is XML representation of all authorizations 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 authorizations:

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

Access authorization by id

Syntax

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

http://localhost:8810/rest/authorizations/<authorization id>

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

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 authorization of id 1:

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

Access authorizations of a particular group

Syntax

Authorizations of particular group can be accessed using http GET method through below url:

http://localhost:8810/rest/authorizations?group_id=<group id>

The response is of mime type application/xml and the content is XML representation of all authorizations of specified group.

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 authorizations of group with id 2:

curl -u admin:admin http://localhost:8810/rest/authorizations?group_id=2

Access authorizations of a particular configuration

Syntax

Authorizations of particular configuration can be accessed using http GET method through below url:

http://localhost:8810/rest/authorizations?configuration_id=<configuration id>

The response is of mime type application/xml and the content is XML representation of all authorizations of specified configuration.

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 authorizations of configuration with id 1:

curl -u admin:admin http://localhost:8810/rest/authorizations?configuration_id=1

Update authorization

Syntax

Authorization can be updated by posting xml representation of the authorization to below url:

http://localhost:8810/rest/authorizations

Normally you do not need to create the XML from scratch: you may retrieve XML representation of the authorization 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 authorization id being updated.

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 change authorization of group developer from configuration root/project1 to root/project2:

  1. Assume id of group developer is 1 , id of configuration root/project1 is 5 , and id of configurtion root/project2 is 6 . Ids of these entities can be retrieved with id service.

  2. Run below command to get authorizations of group developer :

    curl -u admin:admin http://localhost:8810/rest/authorizations?group_id=1
  3. Analyze response of above command to find out the authorization associated with configuration id 5 . Save xml snippet of found authorization to a temp file, say tempfile.xml.

  4. Modify tempfile.xml and change the configuration element to take value 6.

  5. Post content of tempfile.xml back to QuickBuild using below command:

    curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/authorizations

Create authorization

Syntax

Authorization can be created by posting XML representation of the authorization to below url:

http://localhost:8810/rest/authorizations

Please note that the posted XML should NOT contain the id element; otherwise, QuickBuild will treat the post as an updating to the authorization with that id.

Normally you do not need to create the XML from scratch: you may retrieve XML representation of a templating authorization 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 authorization id.

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 authorize group tester (assume the id is 3 ) with RUN_BUILD and STOP_BUILD permission in configuration root/test (assume the id is 2).

  1. Save below content into file tempfile.xml :

    <com.pmease.quickbuild.model.Authorization>
    <group>3</group>
    <configuration>3</configuration>
    <permissions>
    <string>RUN_BUILD</string>
    <string>STOP_BUILD</string>
    </permissions>
    </com.pmease.quickbuild.model.Authorization>
  2. Post content of tempfile.xml to QuickBuild using below command:

    curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/authorizations

Delete authorization

Syntax

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

http://localhost:8810/rest/authorizations/<authorization id>

Here <authorization id} stands for id of the authorization 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 unauthorize configuration root/test (assume id is 2 ) for group tester (assume the id is 3).

  1. Get authorizations of group tester with below command:

    curl -u admin:admin http://localhost:8810/rest/authorizations?group_id=3
  2. Analyze response of above command to find out id of the authorization associated with configuration id 2 , assume id of the found authorization is 100.

  3. Delete the found authorization with below command:

    curl -X DELETE -u admin:admin http://localhost:8810/rest/authorizations/100