Retrieval of the details of all schemas

When you want to modify any schema, you might want to know the basic information about all the schemas that are available in the HCL® OneTest Data project. You can retrieve information about all the schemas by using the GET method.

Prerequisites

You must have the following information before you retrieve the details of all the schemas:

REST API request

To retrieve the information about all the schemas, 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/{project_id}/schemas
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":"5f0eaf9aa0dd6f0179d921ff",
      "project_id":"5f0eaf6ea0dd6f009d2fb694",
      "href":"http://{my-ots}-hip-server:8080/tx-server/rest/v1/tx/projects/5f0eaf6ea0dd6f009d2fb694/schemas/5f0eaf9aa0dd6f0179d921ff",
      "name":"swift_iso15022_2019",
      "tags":[""],
      "created_by":"admin",
      "creation_date":"2020-07-15T07:26:18.251+0000",
      "read_only":true,
      "type":"json"
    },
    {
      "_id":"5f0eafafa0dd6f0179d92200",
      "project_id":"5f0eaf6ea0dd6f009d2fb694",
      "href":"http://{my-ots}-hip-server:8080/tx-server/rest/v1/tx/projects/5f0eaf6ea0dd6f009d2fb694/schemas/5f0eafafa0dd6f0179d92200",
      "name":"swift_iso7775_2019",
      "tags":[""],
      "created_by":"admin",
      "creation_date":"2020-07-15T07:26:39.053+0000",
      "read_only":true,
      "type":"json"
    },
    {
      "_id":"5f0eafdba0dd6f0179d92201",
      "project_id":"5f0eaf6ea0dd6f009d2fb694",
      "href":"http://{my-ots}-hip-server:8080/tx-server/rest/v1/tx/projects/5f0eaf6ea0dd6f009d2fb694/schemas/5f0eafdba0dd6f0179d92201",
      "name":"swift_iso7775_2019_MJH",
      "tags":[""],
      "created_by":"admin",
      "creation_date":"2020-07-15T07:27:23.644+0000",
      "read_only":true,
      "type":"json"
    }
  ],
  "count":3
}

Error codes

The following table lists the error codes that can generate on the failure of the request:
HTTP error codes Response examples
401 (Invalid Bearer Token)
{ 
    "timestamp": "2020-09-04T07:02:24.600Z", 
    "code": 401, 
    "messages": ["Invalid token."] 
} 
401 (Invalid Project Id)
{ 
    "timestamp": "2020-09-04T07:07:35.561Z", 
    "code": 404, 
    "messages": ["A project with id 4150 does not exist."] 

} 

Example of the cURL command

You can also use the following cURL command to retrieve the details of all the schemas of your HCL® OneTest Data project:

curl -X GET "https://otd-fvt2.nonprod.hclpnp.com/onetest-data/rest/v1/otd/projects/1150/schemas" -H "accept: application/json;charset=utf-8" -H "Authorization: Bearer xxxxx"