Schema

The schema REST API provides the ability to create, alter or delete multiple (published) virtual schemas. The operations that can be performed on the resources are:

GET /schema/virtual
PUT /schema/virtual
POST /schema/virtual
DELETE /schema/virtual
DELETE /schema/virtual/{schemaPath}

GET /schema/virtual

This API is used to get summary and/or detailed information about a virtual schema.

Parameters:

Name

Description

Parameter Type

Data Type

path

virtual schema path

query

string

summary

fetch virtual schema summary

query

boolean

Example to Get summary of virtual schema "/services/databases/ publishedDB/sch1"

curl -X GET -u admin:admin "http://localhost:9400/rest/schema/v1/virtual?path=%2Fservices%2Fdatabases%2FpublishedDB%2Fsch1&summary=true" -H "Content-Type:application/json"

Example to Get detailed information about virtual schema "/services/databases/publishedDB/sch1"

curl -X GET -u admin:admin "http://localhost:9400/rest/schema/v1/virtual?path=%2Fservices%2Fdatabases%2FpublishedDB%2Fsch1" -H "Content-Type:application/json"

PUT /schema/virtual

This API is used to Update virtual schemas.

Parameters:

None.

Request Body

Example Value - Schema

[
“path”: "string",
“annotation”: “string”,
“newPath”: “string”,
“ifNotExists”: true
]

Example to Update annotation and rename a published schema "/services/databases/publishedDB/sch1 to /services/databases/ publishedDB/sch2"

curl -X PUT -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch1\", \"annotation\":\"Edited published schema created using REST api\", \"newPath\":\"/services/databases/publishedDB/sch2\"  }]" 

Example to Update annotation and relocate a published schema "/services/databases/publishedDB/sch2 to /services/databases/ publishedDB1/sch2"

curl -X PUT -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch2\", \"annotation\":\"Edited published schema created using REST api\", \"newPath\":\"/services/databases/publishedDB1/sch2\"  }]" 

Example to Unset annotation of published schema "/services/databases/ publishedDB/sch1"

curl -X PUT -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch1\", \"annotation\":\"null\" }]" 

POST /schema/virtual

This API is used to create virtual schemas.

Parameters:

None.

Request Body

Example Value - Schema

[
“path”: "string",
“annotation”: “string”,
“newPath”: “string”,
“ifNotExists”: true
]

Example to Create virtual schema "/services/databases/ publishedDB/sch1"

curl -X POST -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch1\", \"annotation\":\"This is a published schema created using REST api\" }]" 

Example to create virtual schema "/services/databases/ publishedDB/sch1" with "ifNotExists" syntax

curl -X POST -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch1\", \"ifNotExists\":true, \"annotation\":\"This is a published schema created using REST api\" }]" 

DELETE /schema/virtual

This API is used to delete virtual schemas.

Parameters:

 

Name

Description

Parameter Type

Data Type

ifExists

flag to indicate if resource exists

query

boolean

Request Body

Example Value - Schema

[
"string"
]

Example to Delete virtual schema "/services/databases/publishedDB/sch1" and "/services/databases/ publishedDB/sch2"

curl -X DELETE -u admin:admin "http://localhost:9400/rest/ schema/v1/virtual" -H "Content-Type:application/ json" -d "[\"/services/databases/ publishedDB/sch1\", \"/services/databases/ publishedDB/sch2\"]" 

Sample CURL Invocation with "ifExists":

curl -X DELETE -u admin:admin "http://localhost:9400/rest/schema/v1/virtual?ifExists=true" -H "Content-Type:application/json" -d "[\"/shared/examples/publishedDB/sch2\"]"

DELETE /schema/virtual/{schemaPath}

This API is used to delete virtual schema given in the path.

Parameters:

 

Name

Description

Parameter Type

Data Type

schemaPath

Path of the schema

query

string

ifExists

flag to indicate if resource exists

query

boolean

Example to Delete virtual schema

curl -X DELETE -u admin:admin  "http://localhost:9400/rest/schema/v1/virtual/{schemaPath}?ifExists=true"  -H "Content-Type: application/json"
curl -X DELETE -u admin:admin "http://localhost:9400/rest/schema/v1/virtual/%2Fservices%2Fdatabases%2Fpubdb%2Fschema1?ifExists=true" -H "Content-Type:application/json"