Environments REST API specification
For general information about the REST API, see REST Services.
Compatibility with later versions
To improve the compatibility of clients of the REST API with later versions, you must not manually construct URLs, except for the Look up a URL for an environment URL. URLs can be generated by resolving the relative href attributes that are provided in the XML. All href attributes must be resolved against the URL that they were returned from.
List of requests, grouped by resource type
Look up a URL for an environment
URL | RTCP_BASE_URL/rest/environments/ | |
Method | GET | |
Parameters | domain | The name of the domain (required). |
env | The name of the environment (required). | |
Returns | 200 | OK (but may return an empty list) |
400 | BAD REQUEST: If any required query parameters were missing, or if any parameters were invalid. | |
412 | PRECONDITION FAILED: If the domain could not be found. (If the environment could not be found, a 200 OK status code is returned with an empty environments element. This is different from the stubs and scenarios APIs, because in this case it is the environments that are being queried for, rather than looking for other resources inside an environment). |
Response body
|
- href
- URLs point to an environment, relative to RTCP_BASE_URL/rest/environments/
Get a specific environment
URL | Resolve the relative URL retrieved from the Look up a URL for an environment response, relative to RTCP_BASE_URL/rest/environments/, as defined by section 5.2.2 of RFC 3986. | |
Method | GET | |
Returns | 200 | OK |
404 | NOT FOUND: If the environment could not be found. | |
412 | PRECONDITION FAILED: If the domain could not be found. |
Response body
|
- name
- The name of the environment.
- description
- The description of the environment.
- base-environment
- Identifies the environment that is the "base" environment of this environment. This element's href attribute contains a relative URL to the base environment's resource.
- tags
- The environment tags set on this environment. This will not include any environment tags from published Rational Integration Tester projects, only those that have been set on IBM Rational Test Control Panel itself. The tags element will be omitted if there are no tags saved.
- lock
- Provides details of the lock.
- locked
- Indicates whether the environment is currently locked (true) or unlocked (false).
- href
- Points to an environment lock. This URL is present even if the environment is not locked, even though a request on it to Retrieve information on the existing lock, if any. would result in 404 NOT FOUND; it is needed for the POST request used to obtain a lock.
Update the environment tags
URL | Resolve the relative URL retrieved from the Look up a URL for an environment response, relative to RTCP_BASE_URL/rest/environments/, as defined by section 5.2.2 of RFC 3986. | |
Method | PUT | |
Returns | 200 | OK |
400 | BAD REQUEST: If the request data was incorrectly formed. | |
404 | NOT FOUND: If the environment could not be found. | |
412 | PRECONDITION FAILED: If the domain could not be found. | |
423 | LOCKED: If the environment has been locked by another user. |
Request headers
- X-User
- If the domain security is disabled, use this header to specify the user who is performing the operation. This will allow the operation to be performed through an already-obtained environment lock. For more information on environment locks, see environment lock.
- Authorization
- If domain-level security is enabled a security token must be passed as a HTTP Request header. For more information, see REST and Domain level security.
- Content-Type
- application/xml
Request data
- The same format as returned from Get a specific environment,
constructed as follows:
- Construct this data from a GET request performed immediately prior to this PUT request. The tags element may be added before resubmission if it was not present in the GET request response.
- All elements and attributes returned from that GET request MUST be included in the PUT, unless intended to be deleted by this request.
- Only changes to the tags element and its children are supported. All other values MUST be submitted unchanged (however, the server may ignore such invalid changes without returning an error status but this behaviour must not be relied on).
Delete an environment
URL | Resolve the relative URL retrieved from the Look up a URL for an environment response, relative to RTCP_BASE_URL/rest/environments/, as defined by section 5.2.2 of RFC 3986. | |
Method | DELETE | |
Returns | 200 | OK: The environment was deleted. |
204 | NO CONTENT: The environment was deleted. | |
404 | NOT FOUND: If the environment could not be found. | |
405 | METHOD NOT ALLOWED: Delete is not supported for this environment. | |
412 | PRECONDITION FAILED: If the domain could not be found | |
423 | LOCKED: If the environment has been locked by another user. | |
424 | FAILED DEPENDENCY: The environment could not be deleted at this time. Most likely, it is currently in use. |
Request headers
- X-User
- Used to specify the user who is performing the operation. This element is used to perform the operation through an already-obtained environment lock. For more information on environment locks, see environment lock.
- Authorization
- If domain-level security is enabled a security token must be passed as a HTTP Request header. For more information, see REST and Domain level security.
Retrieve information on the existing lock, if any.
URL | Resolve the relative URL retrieved from the "lock" element's "href" attribute from the Get a specific environment response, relative to that resource's URL, as defined by section 5.2.2 of RFC 3986. | |
Method | GET | |
Returns | 200 | A representation of the lock has been returned. The environment may or may not be locked (see note for 404). |
404 | NOT FOUND: If the environment is not locked. Note: do not rely on this status code to determine if an environment is locked. Use the <lock locked="true|false" ... /> attribute on the environment resource as the definitive state of the lock. Future versions of the API may return 200 OK and a representation of an empty lock as the response to this GET request when the environment is not locked. | |
412 | PRECONDITION FAILED: If the domain or environment could not be found |
Response body
|
- name
- The name of the user who acquired the lock.
- start and expected-duration
- measured in milliseconds in the same manner as the java.lang.System.currentTimeMillis() Java™ API method call.
- reason
- Text, specified in character data, either in plain entity-encoded text, or in a CDATA block. Newlines should be respected. There is no guarantee that blocks of whitespace will not be collapsed.
Create an exclusive lock on an environment.
URL | Resolve the relative URL retrieved from the "lock" element's "href" attribute from the Get a specific environment response, relative to that resource's URL, as defined by section 5.2.2 of RFC 3986. | |
Method | POST | |
Returns | 201 | CREATED: If the environment was successfully locked. |
400 | BAD REQUEST: If the request data could not be understood. | |
409 | CONFLICT: If another user already has the lock. | |
412 | PRECONDITION FAILED: If the domain or environment could not be found. |
Request headers
- X-User
-
Used to specify the user who is performing the operation (no password required). This must also be used on all other calls to any REST endpoint that modifies the environment while the environment lock is in place.
- Authorization
- If domain-level security is enabled a security token must be passed as a HTTP Request header. For more information, see REST and Domain level security.
- Content-Type
- application/xml
Request data
|
- This is the same as the Retrieve information on the existing lock, if any. response but the user element and start attribute are ignored.
- The expected-duration attribute is measured in milliseconds in the same manner as the java.lang.System.currentTimeMillis() Java API method call.
- The reason text is specified in character data - either in plain entity-encoded text, or in a CDATA block. Newlines should be respected. There is no guarantee that blocks of whitespace will not be collapsed.
- The expected-duration attribute or the reason element may be omitted.
Release an environment lock
URL | Resolve the relative URL retrieved from the "lock" element's "href" attribute from the Get a specific environment response, relative to that resource's URL, as defined by section 5.2.2 of RFC 3986. | |
Method | DELETE | |
Returns | 200 | OK |
403 | FORBIDDEN: If the specified user is not the one who holds the lock, and is not an admin. | |
404 | NOT FOUND: If there was no lock to release. | |
412 | PRECONDITION FAILED: If the domain or environment could not be found. |
Request headers
- X-User
-
A URL-encoded username to identify the user performing the unlock request (no password required). The user must match the user who created the lock. This can only be performed if the specified user either owns the lock or is an administrator.
- Authorization
- If domain-level security is enabled a security token must be passed as a HTTP Request header. For more information, see REST and Domain level security.