Schema deletion

When you no longer want a schema in your project, you can delete the existing schema by using the DELETE method.

Prerequisites

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

REST API request

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

Request attributes Request parameters
HTTP method DELETE
Endpoint https://{OneTest_Server}/onetest-data/rest/v1/otd/projects/{project_id}/schemas/{schema_id}?force=true
Note: When you set the force attribute as true, the schema is deleted even if it is locked.
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":"5efb2c6f0f11a4009dfdbe6c",
  "message":" Schema deleted successfully",
  “code”:200
}

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 delete a schema from your HCL® OneTest Data project:

curl -X DELETE 'https://otd-fvt2.nonprod.hclpnp.com/onetest-data/rest/v1/otd/projects/10150/schemas/5f0eccada0dd6f009d2fb6b1' \
--header 'Accept: application/json;charset=utf-8' \
--header 'Content-Type: application/json;charset=utf-8' \
--header 'Authorization: Bearer XXXX'