Watches
Following are the operations that can be performed on the watches set up in Business Directory:
GET /watches
This API is used to fetch all watches.
Parameters
None
Example to list all watches
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/watches"
Example to list all watches as ldap user
curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/ watches"
Equivalent system query
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/data/query" -H "query:select * from ALL_WATCHES" -H "standardSQL:true" -H "system:true"
Example to retrieve count of all watches.
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/watches?count"
POST /watches
This API is used to add a new watch for a resource. The provided JSON should be a list of map entries whose keys are resourcePath, resourceType and includeChildren. The values of the map are values associated with the keys.
Parameters
None
Request Body
[
{
"resourcePath": "string",
"resourceType": "string",
"includeChildren": true
}
]
Example to create a new watch on a published resource
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/watches" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/sources/Categories\", \"resourceType\":\"TABLE\", \"includeChildren\":false}]"
Example to create watches for multiple published resources
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/watches" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/sources/Customers\", \"resourceType\":\"TABLE\", \"includeChildren\":false},{\"resourcePath\":\"/localhost_9400/services/databases/ds\", \"resourceType\":\"DATABASE\", \"includeChildren\":true}]"
Example to create watches for multiple published resources as ldap user
curl -X POST -u user@ldapDomain:password "https://localhost:9502/rest/v2/watches" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/sources/ Customers\", \"resourceType\":\"TABLE\", \"includeChildren\":false},{\"resourcePath\":\"/localhost_9400/services/databases/ds\", \"resourceType\":\"DATABASE\", \"includeChildren\":true}]"
DELETE /watches
This API is used to delete a watch on a resource. The provided JSON should be a list of watch IDs that are to be deleted.
Parameters
None
Request Body
[
0
]
Example to delete a watch on a resource
curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/watches" -H "Content-Type:application/json" -d "[1001]"
Example to delete a watch on a resource as ldap user
curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/watches" -H "Content-Type:application/json" -d "[1001]"
Example to delete a watch on a resource (X-HTTP-Method-Override):
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/watches" -H "X-HTTP-Method-Override:DELETE" -H "Content-Type:application/json" -d "[1001]"
PATCH /watches
This API is used to update watches. The provided JSON should be a map whose keys are the watch IDs for which includeChildren parameter needs to be updated. The corresponding values of the map should contain the updated includeChildren boolean value.
Parameters
None
Request Body
{
"additionalProp1": true,
"additionalProp2": true,
"additionalProp3": true
}
Example to update includeChildren on a specific watch ID
curl -X PATCH -u admin:admin "https://localhost:9502/rest/v2/watches" -H "Content-Type:application/json" -d "{\"1001\":\"true\"}"
Example to update includeChildren on a specific watch ID as ldap user
curl -X PATCH -u user@ldapDomain:password "https://localhost:9502/rest/v2/watches" -H "Content-Type:application/json" -d "{\"1001\":\"true\"}"
Example to update includeChildren on a specific watch ID (X-HTTP-Method-Override):
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/watches" -H "X-HTTP-Method-Override:PATCH" -H "Content-Type:application/json" -d "{\"1001\":\"true\"}"
DELETE /watches/users
This API is used to delete all watches based on user IDs. A BD admin provided JSON should be a list of user IDs whose watches are to be deleted. Any user executed JSON should be a list of size 1 containing user ID for whom watches are to be deleted.
Parameters
None
Request Body
[
0
]
Example for a user deleting his own watches
curl -X DELETE -u user:password "https://localhost:9502/rest/v2/watches/ users" -H "Content-Type:application/json" -d "[300]"
Example for a user deleting his own watches as ldap user
curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/watches/users" -H "Content-Type:application/json" -d "[300]"
Example of BD admin deleting other users watches
curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/watches/users" -H "Content-Type:application/ json" -d "[300,400]"
Example for a user deleting his own watches (X-HTTP-Method-Override):
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/watches/users" -H "X-HTTP-Method-Override:DELETE" -H "Content-Type:application/json" -d "[300,400]"
GET /watches/users/{ownerId}
This API is used to fetch watches for a user.
Parameters
Name | Description | Parameter Type | Data Type |
ownerId | The owner's user id | path | integer |
Example to retrieve a watch
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/watches/ users/-1973"
Example to retrieve a watch as ldap user
curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/ watches/ users/-1973"
Equivalent system query
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/data/query" -H "query:select * from ALL_WATCHES where OWNER_ID = -1973" -H "standardSQL:true" -H "system:true"
Example to retrieve count of a watches for a user.
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/watches/ users/-1973?count"
GET /watches/{watchId}
This API is used to fetch a specific watch.
Parameters
Name | Description | Parameter Type | Data Type |
watchId | The watch id or ids | path | integer |
Example to retrieve a watch
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/watches/1234"
Example to retrieve a watch as ldap user
curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/ watches/1234"
Equivalent system query
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/data/query" -H "query:select * from ALL_WATCHES where WATCH_ID = 1234" -H "standardSQL:true" -H "system:true"