Schema import

When you want to use an existing schema to generate the test data, then by using the POST method you can import a schema into the HCL® OneTest Data project. The schema that you want to import must be either in the JSON or XSD format.


You must have the following information before you import a schema:

REST API request

To import a schema, you must use the request with the following attributes:

Request attributes Request parameters
HTTP method POST
Endpoint https://{OneTest_Server}/onetest-data/rest/v1/otd/projects/{project_id}/schemas/import
Authorization Yes
Form data
Property name Data type Description Required
name String Name of the schema Yes
description String Sample description No
type String Schema type No
path String Schema path No
tags Array Schema tags No
file File Schema file Yes
Note: The name and file properties are the mandatory in the request.

Response code

You can view the following response after you run the request:

HTTP response code Response example
  "Message":"Schema imported successfully", 

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)
  "messages":["Invalid token."] 
401 (Session Expired)
  "messages":["Session expired."] 
  "message":" A schema name already exists in project 1150.", 

Example of the cURL command

You can also use the following cURL command to import a schema from your computer to the HCL® OneTest Data project:

curl -X POST '' \ 
--header 'Authorization: Bearer xxxxx' \ 
--header 'Content-Type: multipart/form-data' \ 
--form 'name=Swift Schema' \ 
--form 'file=@swift_iso7775_2019.json'