Retrieval of the type details
When you want to modify a category, a group, or an item type in a schema, you require
the type details, such as type id, type name, and type class. You can retrieve this
information of any type by using the GET
method.
Prerequisites
- A bearer token. See Retrieval of a bearer token.
- Project details. See Retrieval of the project details.
- Schema id of the schema whose type details you want to retrieve. See Retrieval of the details of all schemas.
- Type path for the selected type. The type path is a path of any type in a schema.
REST API request
To retrieve the information about a specific type of a 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}/type_path/{type_path} For example, if a schema has a Root category in the dictionary, with Student group and Name item type, then the Type path for Student type is - Root:Student Type path for Name type is - Root:Name |
Authorization | Yes |
Request body | Null |
Response code
You can view the following response after you run the request:
HTTP response code | Response example |
---|---|
200 |
{ "type_id":"1", "type_name":"Name", “type_class”:”item” } |
Error codes
The following table lists the error codes that can generate on the failure of the request:
HTTP error codes | Response examples |
---|---|
400 |
Null Project Id { "timestamp":"2020-07-31T06:35:22.456Z", "code":400, "messages":["Project Id cannot be null."] } Null Schema Id { "timestamp":"2020-07-31T06:35:54.198Z", "code":400, "messages":["Schema Id cannot be null."] } Null TypePath { "timestamp":"2020-07-31T06:36:13.046Z", "code":400, "messages":["Type path cannot be null."] } |
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 |
Invalid Project Id { "timestamp":"2020-07-31T06:06:14.965Z", "code":404, "messages":["A project with id 115 does not exist."] } Invalid Schema Id { "timestamp":"2020-07-31T06:05:59.843Z", "code":404, "messages":["A schema with id 5f23ae5de423920008 does not exist in project 1150."] } Invalid TypePath { "timestamp":"2020-07-31T06:05:42.794Z", "code":404, "messages":["Invalid Type Path."] } |
500 |
{ "_id":null, "name":null, "message":"", "code":500 } |
Example of the cURL command
You can also use the following cURL command to retrieve the details of a type of a schema:
curl -X GET "https://otd-fvt2.nonprod.hclpnp.com/onetest-data/rest/v1/otd/projects/schemas/getTypeInfo?project_id=1150&schema_id=5f2aa6689021c4009d6c8d7a&type_path=Root%3ANewType1" -H "accept: application/json;charset=utf-8" -H "Authorization: Bearer xxxxxxxxx"