Application Programming Interface Guide > REST API > TDV Server REST APIs > Dataview
 
Dataview
The dataview API provides the ability to create, alter, delete and read dataviews. The following operations can be performed:
GET/dataview
PUT/dataview
POST/dataview
DELETE/dataview
DELETE/dataview/{dataviewPath}
GET/dataview
This API is used to get data view summary and/or detailed information.
Parameters:
Name
Description
Parameter Type
Data Type
path
data view path
query
string
summary
fetch data view summary
query
boolean
Example to Get data view summary "/shared/examples/sampleView"
curl -X GET -u admin:admin "http://localhost:9400/rest/dataview/v1?path=%2Fshared%2Fexamples%2FsampleView&summary=true" -H "Content-Type:application/json"
Example to Get detailed information of data view "/shared/examples/sampleView"
curl -X GET -u admin:admin "http://localhost:9400/rest/dataview/v1?path=%2Fshared%2Fexamples%2FsampleView" -H "Content-Type:application/json"
PUT/dataview
This API is used to update data views.
Parameters:
None
Request Body
Example Value - Schema
[
{
"parentPath": "string",
"name": "string",
"sql": "string",
"annotation": "string",
"newPath": "string",
"ifNotExists": true,
"properties": {
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
}
}
]
Example to update sql and annotation of data view "/shared/examples/ sampleView"
curl -X PUT -u admin:admin "http://localhost:9400/rest/dataview/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"sampleView\", \"sql\":\"SELECT OrderID,CompanyName FROM /shared/examples/ViewOrder\", \"annotation\":\"Edited annotation of a data view created using REST api\" }]"
Example to Unset annotation of data view "/shared/examples/sampleView"
curl -X PUT -u admin:admin "http://localhost:9400/rest/dataview/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"sampleView\", \"annotation\":\"null\" }]"
POST/dataview
This API is create data views with specified definition sql.
Parameters:
None
Request Body
Example Value - Schema
[
{
"parentPath": "string",
"name": "string",
"sql": "string",
"annotation": "string",
"newPath": "string",
"ifNotExists": true,
"properties": {
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
}
}
]
Example to Create data view "/shared/examples/sampleView"
curl -X POST -u admin:admin "http://localhost:9400/rest/dataview/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"sampleView\", \"sql\":\"SELECT OrderID FROM /shared/examples/ViewOrder\", \"annotation\":\"This view is created using REST api\"}]"
Example to Create data view "/shared/examples/dataview1" with "ifNotExists" syntax
curl -X POST -u admin:admin "http://localhost:9400/rest/dataview/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\" : \"dataview1\", \"ifNotExists\":true, \"annotation\":\"This is a data view created using REST api\" }]"
DELETE/dataview
This API is used to delete data views.
Parameters:
Name
Description
Parameter Type
Data Type
ifExists
flag to indicate whether the data view exists.
query
boolean
Request Body
Example Value - Schema
[
"string"
]
Example to Delete data view "/shared/examples/sampleView"
curl -X DELETE -u admin:admin "http://localhost:9400/rest/dataview/v1" -H "Content-Type:application/json" -d "[\"/shared/examples/sampleView\"]"
Sample CURL Invocation with "ifExists"
curl -X DELETE -u admin:admin "http://localhost:9400/rest/dataview/v1?ifExists=true" -H "Content-Type:application/json" -d "[\"/shared/examples/sampleView\"]"
DELETE/dataview/{dataviewPath}
This API is used to delete data view. Optionally specify "if exists".
Parameters:
Name
Description
Parameter Type
Data Type
dataViewPath
Path of the data view
query
string
ifExists
flag to indicate if the dataview exists
query
boolean
Example to delete data view
curl -X DELETE -u admin:admin "http://localhost:9400/rest/dataview/v1/{dataViewPath}?ifExists=true" -H "Content-Type: application/json"
Sample CURL Invocation with "ifExists"
curl -X DELETE -u admin:admin "http://localhost:9400/rest/dataview/v1/%2Fshared%2Fexamples%2Fdataview1?ifExists=true" -H "Content-Type:application/json"