Retrieval of schema details

When you want to perform any operation on a schema, you must know certain details about that schema. You can retrieve the details of a specific schema by using the GET method.

Prerequisites

You must have the following information before you retrieve the schema details:

REST API request

To retrieve the information about a specific schema, 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/{schema_id}
Authorization Yes
Request body Null

Response code

You can view the following response after you run the request:
HTTP response code Response example
200
{
	"_id":"5efc3ce80f11a4009dfdbe8f",
	"project_id":"1150",
	"href":"http://{my-ots}-hip-server:8080/tx-server/rest/v1/tx/projects/1150/schemas/5efc3ce80f11a4009dfdbe8f",
	"name":"ExampleSchema1",
	"description":"otdschema11",
	"tags":[""],
	"created_by":"otduser",
	"creation_date":"2020-07-01T07:36:08.814+0000",
	"version":1,
	"model_version":1,
	"type":"tree",
	"referenced_xsds":[],    
	"current_id":1,
	"candidate_roots":[],
	"current_types":1,
	"xsi_types":[],
	"global_elements":[]
}

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 Token)
{
  "timestamp":"2020-07-01T05:22:29.233Z",
  "code":401,
  "messages":["Invalid token."]
}
401 (Session Expired)
{
  "timestamp":"2020-07-01T05:22:29.233Z",
  "code":401,
  "messages":["Session expired."]
}
404
{
  "timestamp":"2020-07-19T13:21:02.713Z",
  "code":404,
  "messages":["A schema with id 5f141c681846b5009d92f9a0 does not exist in project 1150."]
}
500
{
  "timestamp":"2020-07-19T13:21:02.713Z",
  "code":500,
  "messages":[""]
}

Example of the cURL command

You can also use the following cURL command to retrieve the details of a specific schema of your HCL® OneTest Data project:

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