Schema download

When you generate a schema, you might want to download the file on your computer. You must use the GET method to download the schema. The schema that you want to download must be either in the JSON or XSD format.

Prerequisites

You must have the following information before you download the file:

REST API request

To download a file that contains 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}/content
Authorization Yes
Request body Null

Response code

The response of the download request is a .zip file. The .zip file contains a schema either in the JSON or XSD format.
HTTP response code Response example
200 File with schema either in the JSON or XSD format.

Error codes

The following table lists the error codes that can generate on the failure of the request:
HTTP error codes Response examples
400
{
    "timestamp":"2020-08-17T06:35:46.034Z",
    "code":400,
    "messages":["A schema with id 5f22b2cde42392009d8ecef6 does not exist in project 1450."]
}
401 (Invalid Token)
{
    "timestamp":"2020-08-17T06:33:31.630Z",
    "code":401,
    "messages":["Invalid token."]
} 
404
{
    "timestamp":"2020-08-17T06:35:18.930Z",
    "code":404,
    "messages":["A project with id 1150 does not exist."]
}

Example of the cURL command

You can also use the cURL command to download the file that contains the schema.

For example, you can use the following command to download a schema from your project:

curl -X GET "https://otd-fvt2.nonprod.hclpnp.com/onetest-data/rest/v1/otd/projects/1150/schemas/5efb2c6f0f11a4009dfdbe6c/content" -H "accept: application/octet-stream" -H "Authorization: Bearer xxxxxx"