Categories
The following operations can be performed on the different categories of the BD resources:
GET /categories
This API is used to get all categories.
Parameters
None
Example to get all categories
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/categories"
Example to get all categories as ldap user
curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories"
Example to get all categories count
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/categories?count"
POST /categories
This API is used to create new categories and values. The provided JSON should be a list of CategoryBeans that you'd like to add or update. A CategoryBean consists of a categoryName and List of category values. If the set of values is empty, then the category will be added without any values. If the category already exists, then the given values will be added to the category.
Parameters
None
Request Body
[
{
"categoryName": "string",
"categoryValues": [
"string"
]
}
]
Example to create a new category "category1" with empty values
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/categories" -H "Content-Type:application/json" -d "[{\"categoryName\":\"category1\", \"categoryValues\" : []}]"
Example to create a new category "category1" with empty values as ldap user
curl -X POST -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories" -H "Content-Type:application/json" -d "[{\"categoryName\":\"category1\", \"categoryValues\" : []}]"
Example to create a new category "category2" with values categoryValue1, categoryValue2, categoryValue3
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/categories" -H "Content-Type:application/json" -d "[{\"categoryName\":\"category2\",\"categoryValues\":[\"categoryValue1\",\"categoryValue2\",\"categoryValue3\"]}]"
Example to add values to existing category "category2"
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/categories" -H "Content-Type:application/json" -d "[{\"categoryName\":\"category2\",\"categoryValues\":[\"categoryValue4\",\"categoryValue5\",\"categoryValue6\"]}]"
DELETE /categories
This API is used to delete categories and values. The provided JSON should be a map whose keys are the categories that you'd like to delete. The values of the map are a set of values to delete within the category. If the set of values is empty, then the entire category will be deleted.
Parameters
None
Request Body
[
{
"categoryName": "string",
"categoryValues": [
"string"
]
}
]
Example to delete categories category1 and category2
curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/categories" -H "Content-Type:application/json" -d "[{\"categoryName\" : \"category1\" }, { \"categoryName\" : \"category2\" }]"
Example to delete values "categoryValue1", "categoryValue2", "categoryValue3" from category category2
curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/categories" -H "Content-Type:application/json" -d "[{\"categoryName\" : \"category2\", \"categoryValues\" : [\"categoryValue1\",\"categoryValue2\",\"categoryValue3\"]}]"
Example to delete values "categoryValue1", "categoryValue2", "categoryValue3" from category category2 as an ldap user
curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories" -H "Content-Type:application/json" -d "[{\"categoryName\" : \"category2\", \"categoryValues\" : [\"categoryValue1\",\"categoryValue2\",\"categoryValue3\"]}]"
PATCH /categories
This API is used to rename categories and values.
Parameters
None
Request Body
[
{
"op": "RENAME_CATEGORY",
"oldCategoryValue": "string",
"oldCategoryName": "string",
"newCategoryOrCategoryValueName": "string"
}
Example to Rename category "originalCategoryName1" to "category1"
curl -X PATCH -u admin:admin "https://localhost:9502/rest/v2/categories" -H "Content-Type:application/json" -d "[{\"op\":\"RENAME_CATEGORY\", \"oldCategoryName\":\"originalCategoryName1\", \"newCategoryOrCategoryValueName\":\"category1\"}]"
POST /categories/classifications
This API is used to classify resources by associating them with categories and values. The classifications you specify in the request body (JSON) for each resource replace any current classifications for that resource, so you can use this method both to add and remove classifications.
Parameters
None.
Request Body
[
{
"resourcePath": "string",
"resourceType": "string",
"classifications": [
{
"categoryName": "string",
"categoryValues": [
"string"
]
}
]
}
]
Example to classify a resource with Multiple categories/values
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/categories/classifications" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/foo/bar/orders\", \"resourceType\":\"database_table\", \"classifications\":[{\"categoryName\":\"sales\",\"categoryValues\":[\"hrsales\",\"prodsales\"]}]}]"
Example to classify a resource with Multiple categories/values as ldap user
curl -X POST -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/classifications" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/foo/bar/orders\", \"resourceType\":\"database_table\", \"classifications\":[{\"categoryName\":\"sales\",\"categoryValues\":[\"hrsales\",\"prodsales\"]}]}]"
Example to remove classifications for a resource
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/categories/classifications" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/foo/bar/orders\", \"resourceType\":\"database_table\", \"classifications\": null }]"
GET /categories/CategoryName
This API is used to get a category.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | The name of the category to get. | path | string |
Example to get category "category2"
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/categories/category2"
Example to get category "category2" as ldap user
curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/category2"
PATCH /categories/CategoryName
This API is used to rename a single category and/or its values.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | The name of the category to rename. | path | string |
Example to rename category "category1" to "oldCategoryName1"
curl -X PATCH -u admin:admin "https://localhost:9502/rest/v2/categories/oldCategoryName1" -H "Content-Type:application/json" -d "[{\"op\":\"RENAME_CATEGORY\", \"newCategoryOrCategoryValueName\":\"category2\"}]"
Example to rename category "category1" to "oldCategoryName1" as ldap user
curl -X PATCH -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/oldCategoryName1" -H "Content-Type:application/json" -d "[{\"op\":\"RENAME_CATEGORY\", \"newCategoryOrCategoryValueName\":\"category2\"}]"
Example to Rename category value name "category1/value1" to "category1/value2"
curl -X PATCH -u admin:admin "https://localhost:9502/rest/v2/categories/category1" -H "Content-Type:application/json" -d "[{\"op\":\"RENAME_CATEGORY_VALUE\", \"oldCategoryValue\":\"value1\", \"newCategoryOrCategoryValueName\":\"value2\"}]"
Example to Rename category name and value "category1/value1" to "category2/value2"
curl -X PATCH -u admin:admin "https://localhost:9502/rest/v2/categories/category1" -H "Content-Type:application/json" -d "[{\"op\":\"RENAME_CATEGORY\", \"newCategoryOrCategoryValueName\":\"category2\"}, {\"op\":\"RENAME_CATEGORY_VALUE\", \"oldCategoryValue\":\"value1\", \"newCategoryOrCategoryValueName\":\"value2\"}]"
GET /categories/categoryName/values
This API is used to get values for a category.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | The name of the category for which to get values.. | path | string |
Example to get values for category "category2"
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/categories/category2/values"
Example to get values for category "category2" as ldap user
curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/category2/values"
Example to get value count for category "category2"
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/categories/category2/values?count"
POST /categories/categoryName/values
This API is used to create new values in a category. The provided JSON should be a list of string values that you'd like to add to the category.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | The name of the category to which to add new values | path | string |
Request Body
[
"string"
]
Example to update category "category2" with new values categoryValue1, categoryValue2, categoryValue3
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/categories/category2/values" -H "Content-Type:application/json" -d "[\"categoryValue1\",\"categoryValue2\",\"categoryValue3\"]"
Example to update category "category2" with new values categoryValue1, categoryValue2, categoryValue3 as ldap user
curl -X POST -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/category2/values" -H "Content-Type:application/json" -d "[\"categoryValue1\",\"categoryValue2\",\"categoryValue3\"]"
DELETE /categories/categoryName/values
This API is used to drop all values from a category.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | The name of the category to which to add new values | path | string |
Example to drop all values from category "category2"
curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/categories/category2/values"
Example to drop all values from category "category2" as ldap user
curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/category2/values"
GET /categories/{categoryName}/values/{categoryValueName}/resources
This API is used to fetch classifications for a particular category value.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | The name of the category | path | string |
categoryValueName | The name of the category value | path | string |
Example to list classifications for the products/bestseller category/value pair
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/categories/products/values/bestseller/resources"
Example to list classifications for the products/bestseller category/value pair as ldap user
curl -X GET -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/products/values/bestseller/resources"
Equivalent system query:
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/data/typed" -H "Content-Type:application/json" -d "{\"query\":\"select * from ALL_CLASSIFICATIONS where CATEGORY_VALUE_ID IN (select CATEGORY_VALUE_ID from ALL_CATEGORY_VALUES where CATEGORY_NAME = 'products' and CATEGORY_VALUE_NAME = 'bestseller' )\",\"standardSQL\":true}"
Example to get the count of classifications for the products/bestseller category/value pair
curl -X GET -u admin:admin "https://localhost:9502/rest/v2/categories/products/values/bestseller/resources?count"
POST /categories/{categoryName}/values/{categoryValueName}/resources
This API is used to classify resources by associating them with a category/value pair.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | Category name with which to classify the resource | path | string |
categoryValueName | Category value with which to classify the resource | path | string |
Request Body
[
{
"resourcePath": "string",
"resourceType": "string"
}
]
Example to Classify a resource with the products/bestseller category/value pair
curl -X POST -u admin:admin "https://localhost:9502/rest/v2/categories/products/values/bestseller/resources" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/ds/foo\", \"resourceType\":\"database_table\"}]"
Example to Classify a resource with the products/bestseller category/value pair as ldap user
curl -X POST -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/products/values/bestseller/resources" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/ds/foo\", \"resourceType\":\"database_table\"}]"
PUT /categories/{categoryName}/values/{valueName}
This API is used to rename a single category value.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | Category under which a value is to be renamed. | path | string |
categoryValueName | Category value to rename | path | string |
body | The new category value | body | string |
Example to rename category value "category1/Value1" to "oldCategoryName1/RenamedValue1"
curl -X PUT -u admin:admin "https://localhost:9502/rest/v2/categories/category1/values/Value1" -H "Content-Type:application/json" -d "RenamedValue1"
Example to rename category value "category1/Value1" to "oldCategoryName1/RenamedValue1" as ldap user
curl -X PUT -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/category1/values/Value1" -H "Content-Type:application/json" -d "RenamedValue1"
DELETE /categories/{categoryName}/values/{valueName}/resources
This API is used to remove resource classifications.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | The name of the category associated with the classification to remove. | path | string |
categoryValueName | The name of the category value associated with the classification to remove | path | string |
Example to remove the products/bestseller classification from a resource
curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/categories/products/values/bestseller/resources" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/ds/foo\", \"resourceType\":\"database_table\"}]"
Example to remove the products/bestseller classification from a resource as ldap user
curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/products/values/bestseller/resources" -H "Content-Type:application/json" -d "[{\"resourcePath\":\"/localhost_9400/services/databases/ds/foo\", \"resourceType\":\"database_table\"}]"
DELETE /categories/{categoryName}/values/{valueName}/resources/ {resourceType}/{resourcePath}
This API is used to remove a resource classification.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | The name of the category associated with the classification to remove. | path | string |
valueName | The name of the value to unclassify | path | string |
resourceType | The type of the resource from which the category value is to be unclassified | path | string |
resourcePath | The path of the resource from which the category value is to be unclassified. URL Encode any slashes in the path | path | string |
Example to remove classifications from a resource
curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/categories/products/values/bestseller/resources/database_table/%2Flocalhost_9400%2Fservices%2Fdatabases%2Ffoo%2Fbar%2Forders"
Example to remove classifications from a resource as ldap user
curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/products/values/bestseller/resources/database_table/%2Flocalhost_9400%2Fservices%2Fdatabases%2Ffoo%2Fbar%2Forders"
DELETE /categories/{categoryName}/values/{value}
This API is used to drop a value from a category.
Parameters
Name | Description | Parameter Type | Data Type |
categoryName | The name of the category from which to delete a value | path | string |
value | The name of the value to delete from the category | path | string |
Example to drop from category "category2" the value "categoryValue3"
curl -X DELETE -u admin:admin "https://localhost:9502/rest/v2/categories/category2/values/categoryValue3"
Example to drop from category "category2" the value "categoryValue3" as ldap user
curl -X DELETE -u user@ldapDomain:password "https://localhost:9502/rest/v2/categories/category2/values/categoryValue3"