Retrieval of the project details
When you want to perform any operation on a schema, you must have the details of all
the projects. You can retrieve the project details by using the GET
method.
Prerequisites
You must have the following information before you retrieve the project details:
- An access to HCL OneTest™ Server.
- A bearer token. See Retrieval of a bearer token.
You must have
REST API request
To retrieve the information about all your projects in HCL OneTest™ Server, you must use the request with the following attributes:
Request attributes | Request parameters |
---|---|
HTTP method | GET |
Endpoint | https://{OneTest_Server}/onetest-data/rest/v1/otd/projects/ |
Authorization | Yes |
Request body | Null |
Response code
You can view the following response after you run the request:
HTTP response code | Response example |
---|---|
200 |
{ "resources": [ { "_id": "1150", "href": "http://{my-ots}-hip-server:8080/tx-server/rest/v1/tx/projects/1150", "name": "test1", "tags": [] }, { "_id": "1350", "href": "http://{my-ots}-hip-server:8080/tx-server/rest/v1/tx/projects/1350", "name": "otdproject", "tags": [] }, { "_id": "1550", "href": "http://{my-ots}-hip-server:8080/tx-server/rest/v1/tx/projects/1550", "name": "testProject-01", "tags": [] } ], "count": 3 } |
Error codes
The following table lists the error code that can generate on the failure of the
request:
HTTP error codes | Response example |
---|---|
401(Invalid Bearer Token) |
{ "timestamp": "2020-09-04T07:02:24.600Z", "code": 401, "messages": [ "Invalid token." ] } |
Example of the cURL command
You can also use the following cURL command to retrieve the project details:
curl -X GET 'https://otd-fvt1.nonprod.hclpnp.com/onetest-data/rest/v1/otd/projects/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer XXXX'