Retrieval of the details of all types
When you want to view the list of all the types and know their details, you can
retrieve the details of all the types by using the GET
method.
You must have the following information before you retrieve the type details:
- 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.
REST API request
To retrieve the information about all the types 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 |
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” }, { "type_id":"2", "type_name":"Age", “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."] } |
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."] } |
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 all the types of a schema:
curl -X GET "https://otd-fvt2.nonprod.hclpnp.com/onetest-data/rest/v1/otd/projects/schemas/getAllTypeInfo?project_id=1150&schema_id=5f2aa6689021c4009d6c8d7a" -H "accept: application/json;charset=utf-8" -H "Authorization: Bearer xxxxx"