Get all categories
/km/api/v1/categories
This method returns a list of Category objects from the Oracle Knowledge repository.
This resource supports the orderBy request parameter. You can use this parameter with the HTTP service request to sort the returned list.
You can find the different values to use with the orderBy parameter in the schema and catalog information of the resource. To get the schema and catalog information, use the GET method with the mediaType value as 'application/schema+json'
in the HTTP request.
Category and Product Visibility Filtering
The visibility of products and categories is dependent on the type of user making the request, and views associated with the request.
The example URI to get the schema and catalog of the resource is as follows:
http://<IM_REST_API_HOST>/km/api/latest/metadata-catalog/categories
Example URIs
The example URIs for this method are as follows:
http://<IM_REST_API_HOST>/km/api/latest/categories
The request returns a list of Category objects in the Oracle Knowledge repository.
- http://<IM_REST_API_HOST>/km/api/latest/categories?orderBy=name
http://<IM_REST_API_HOST>/km/api/latest/categories?mode=KEY
The request returns a list of Category objects in the Oracle Knowledge repository in KEY mode.
The request returns a list of Category objects in the Oracle Knowledge repository, sorted by name.
Find by query
Supported Media Types: 'application/json', 'application/xml'
This method returns a list of Category objects that match the specified criteria.
You must get the schema and catalog of the resource for additional values that you can use with the orderBy parameter. To get the schema and catalog of the resource, you must use the GET method with the mediaType value as 'application/schema json'
in the HTTP request.
When the withParents request parameter is set to true, for each returned category that match the specified criteria the parent categories of that category will be included, ordered from the root category to the immediate parent of each returned category.
Category and Product Visibility Filtering
The visibility of products and categories is dependent on the type of user making the request, the content type and views associated with the request, and the value of the topLevelOnly parameter. The content type, interface ID, and topLevelOnly request parameters are all optional.
The example URI to get schema and catalog of the resource is as follows:
http://<IM_REST_API_HOST>/km/api/latest/metadata-catalog/categories
Example URIs
The example URIs for this method are as follows:
http://<IM_REST_API_HOST>/km/api/latest/categories?q=sortOrder gt 3
The request returns the list of Category objects that have sortOrder parameter value as numbers greater than three.
http://<IM_REST_API_HOST>/km/api/latest/categories?q=recordId eq '{id}'
The request returns a Category object having the record ID specified with the request.
http://<IM_REST_API_HOST>/km/api/latest/categories?withParents=true&q=recordId eq '{id}'
The request returns a Category object having the record ID specified with the request. List of parent categories that matches the visibility filtering rules will be included in the returned category object.
http://<IM_REST_API_HOST>/km/api/latest/categories?q=parent.refKey eq 'SEARCH'
The request returns a list Category objects which has parent reference key value as SEARCH.
http://<IM_REST_API_HOST>/km/api/latest/categories?q=contentTypeRefKey eq 'FAQ'
The request returns a list Category objects which is associated with Channel FAQ. NOTE : Only Out Of The box content types are supported. User defined content types will not return any results.
http://<IM_REST_API_HOST>/km/api/latest/categories?q=contentTypeRefKey in ('FAQ','SOLUTION')
The request returns a list Category objects which is associated with Channel FAQ OR SOLUTION. NOTE : Only Out Of The box content types are supported. User defined content types will not return any results.
http://<IM_REST_API_HOST>/km/api/latest/categories?q=parent.refKey eq 'SEARCH' and dateAdded gt '2015-02-01'
The request returns a list Category objects which have parent reference key value as SEARCH, and are created after the February 1, 2015.
http://<IM_REST_API_HOST>/km/api/latest/categories?q=topLevelOnly eq true
The request returns a list of top-level Category objects, i.e. the objects do not have a parent.
http://<IM_REST_API_HOST>/km/api/latest/categories?q=topLevelOnly eq true and externalType eq 'CATEGORY'
The request returns a list of top-level Category objects with an external type of CATEGORY.
http://<IM_REST_API_HOST>/km/api/latest/categories?q=topLevelOnly eq true and externalType eq 'PRODUCT'
The request returns a list of top-level Category objects with an external type of PRODUCT.
Response Errors
The possible error responses for this method are as follows:
- OKDOM-CRIT0025
The error occurs when an invalid criteria field is specified in the request.
The following table describes the query parameters for this resource.
Parameter | Queryable | Sortable | Type | Description |
---|---|---|---|---|
recordId | Y | Y | 'type' : 'string' | The unique record ID of the Category object. |
referenceKey | Y | Y | 'type' : 'string' | The reference key for the Category object. Category objects support multiple languages. This field can be used to identify the associated objects for all languages. |
name | Y | Y | 'type' : 'string' | The name of the category. |
externalId | Y | Y | 'type' : 'integer' | The unique identifier used while integrating the repository data with the external system. |
externalType | Y | Y | 'type' : 'string' | The type of the category used while integrating the repository data with the external system. Valid options are PRODUCT and CATEGORY. |
dateAdded | Y | Y | 'type' : 'string', 'format' : 'date-time' | The date when the Category object was created or added. |
dateModified | Y | Y | 'type' : 'string', 'format' : 'date-time' | The date when the Category object was last modified. A category is considered to be modified in any of the following situations:
|
sortOrder | Y | Y | 'type' : 'integer' | The assigned position of category object in the list of objects. |
topLevelOnly | Y | N | 'type' : 'boolean' | Flag to return only top level categories. |
contentTypeRefKey | Y | N | 'type' : 'string' | This parameter is to filter categories by ContentType refKey. |
contentTypeId | Y | N | 'type' : 'string' | This parameter is to filter categories by ContentType recordid. |
required | Y | N | 'type' : 'boolean' | This parameter is to filter categories if they are required or optional in ContentType. |
children | Y | N | '$ref' : '#/definitions/ListCategoryKey' | The children or sub categories of the specific category. |
parent | Y | N | '$ref' : '#/definitions/CategoryKey' | The parent category of the specific category. |
Request
-
limit(optional): integer
This parameter restricts the number of resources returned inside the resource collection. If the limit exceeds the resource count then the framework will only return the available resources.
-
mode(optional): string
This parameter defines amount of information to be included in the returned resources - KEY is the one that has least information (and hence performs better) and FULL is the one that has most information.Allowed Values:
[ "KEY", "DATA", "EXTENDED", "FULL" ]
-
offset(optional): integer
Used to define the starting position of the resource collection. If offset exceeds the resource count then no resources are returned. Default value is 0.
-
orderBy(optional): string
This parameter orders a resource collection based on the specified attributes. The parameter value is a comma-separated string of attribute names, each optionally followed by a colon and 'asc' or 'desc'. Specify 'asc' for ascending and 'desc' for descending. The default value is 'asc'. For example, ?orderBy=field1:asc,field2:desc.
-
q(optional): string
Value for this parameter should be Oracle Knowledge Q query - see the 'Getting Started' documentation ('Querying' page) of this operation and documentation for Q query.
Response
- application/json
- application/xml
200 Response
object
ResultList CategoryData
-
count(optional):
integer
Number of resource instances returned in the current range.
-
hasMore(optional):
boolean
Boolean value that is set to true if more resources are available on the server than the subset returned in current page.
-
items(optional):
array items
-
limit(optional):
integer
Actual paging size used by the server.
-
links(optional):
array links
-
offset(optional):
integer
Offset value used in the current page.
-
totalResults(optional):
integer
Total count of the resource instances, including both the instances in the current range and the instances on the server that satisfy the request.
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
object
CategoryData
-
childrenCount(optional):
integer
This field will return number of immediate children a category has.
This field will only be populated if childrenCount query parameter is passed in with value true.
Example URIs for the this parameter are as follows:
- http://<IM_REST_API_HOST>/km/api/categories/{id}?childrenCount=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?childrenCount=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?q=contentTypeRefKey eq 'FAQ'&childrenCount=true&mode=KEY
-
dateAdded(optional):
string(date-time)
The date when the Category object was created or added.
-
dateModified(optional):
string(date-time)
The date when the Category object was last modified.
A category is considered to be modified in any of the following situations:
- The category is created. The parent category to which the new category is added to is also considered as modified.
- The name of the category is changed in any locale.
- A child category is deleted.
- The category is moved. A moved category has a new parent,so the previous and new parent categories are also considered as modified.
- The sort order of the category is changed. The sort orders of sibling categories also undergo change, so those categories are also considered as modified.
-
description(optional):
string
Description of the Category object
-
externalId(optional):
integer
The unique identifier used while integrating the repository data with the external system.
-
externalType(optional):
string
The type of the category used while integrating the repository data with the external system. Valid options are PRODUCT and CATEGORY.
-
hasChildren(optional):
boolean
Flag to determine if category has children.
-
inventoryOrgId(optional):
integer
The inventory organization id of the specific product.
-
links(optional):
array links
-
name(optional):
string
The name of the category.
-
objectId(optional):
string
The hierarchichal position of the category
-
parents(optional):
array parents
This field will return all parents of category.
This field will only be populated if withParents query parameter is passed in with value true.
Example URIs for the this parameter are as follows:
- http://<IM_REST_API_HOST>/km/api/categories/{id}?withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?q=contentTypeRefKey eq 'FAQ'&withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories/{id}?childrenCount=true&withParents=true&mode=KEY
-
recordId(optional):
string
The unique record ID of the Category object.
-
referenceKey(optional):
string
The reference key for the Category object. Category objects support multiple languages. This field can be used to identify the associated objects for all languages.
-
responseLocale(optional):
string
This is a custom field that will get populated if a name is translated into the default locale when the translated name is not found.
-
sortOrder(optional):
integer
The assigned position of category object in the list of objects.
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
array
This field will return all parents of category.
This field will only be populated if withParents query parameter is passed in with value true.
Example URIs for the this parameter are as follows:
- http://<IM_REST_API_HOST>/km/api/categories/{id}?withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?q=contentTypeRefKey eq 'FAQ'&withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories/{id}?childrenCount=true&withParents=true&mode=KEY
-
Array of:
object CategoryKey
Title:
CategoryKey
object
-
href:
string
URI [RFC3986] or URI Template [RFC6570]. If the value is set to URI Template, then the "templated" property must be set to true.
-
mediaType(optional):
string
Media type, as defined by RFC 2046, describing the link target.
-
method(optional):
string
HTTP method for requesting the target of the link.
-
profile(optional):
string
Link to the metadata of the resource, such as JSON-schema, that describes the resource expected when dereferencing the target resource..
-
rel:
string
Name of the link relation that, in addition to the type property, can be used to retrieve link details. For example, href or profile.
-
templated(optional):
boolean
Boolean flag that specifies that "href" property is a URI or URI Template. If the property is a URI template, set this value to true. By default, this value is false.
object
CategoryKey
-
childrenCount(optional):
integer
This field will return number of immediate children a category has.
This field will only be populated if childrenCount query parameter is passed in with value true.
Example URIs for the this parameter are as follows:
- http://<IM_REST_API_HOST>/km/api/categories/{id}?childrenCount=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?childrenCount=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?q=contentTypeRefKey eq 'FAQ'&childrenCount=true&mode=KEY
-
description(optional):
string
Description of the Category object
-
externalId(optional):
integer
The unique identifier used while integrating the repository data with the external system.
-
externalType(optional):
string
The type of the category used while integrating the repository data with the external system. Valid options are PRODUCT and CATEGORY.
-
inventoryOrgId(optional):
integer
The inventory organization id of the specific product.
-
links(optional):
array links
-
name(optional):
string
The name of the category.
-
objectId(optional):
string
The hierarchichal position of the category
-
parents(optional):
array parents
This field will return all parents of category.
This field will only be populated if withParents query parameter is passed in with value true.
Example URIs for the this parameter are as follows:
- http://<IM_REST_API_HOST>/km/api/categories/{id}?withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?q=contentTypeRefKey eq 'FAQ'&withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories/{id}?childrenCount=true&withParents=true&mode=KEY
-
recordId(optional):
string
The unique record ID of the Category object.
-
referenceKey(optional):
string
The reference key for the Category object. Category objects support multiple languages. This field can be used to identify the associated objects for all languages.
-
responseLocale(optional):
string
This is a custom field that will get populated if a name is translated into the default locale when the translated name is not found.
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
array
This field will return all parents of category.
This field will only be populated if withParents query parameter is passed in with value true.
Example URIs for the this parameter are as follows:
- http://<IM_REST_API_HOST>/km/api/categories/{id}?withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories?q=contentTypeRefKey eq 'FAQ'&withParents=true&mode=KEY
- http://<IM_REST_API_HOST>/km/api/categories/{id}?childrenCount=true&withParents=true&mode=KEY
-
Array of:
object CategoryKey
Title:
CategoryKey
Examples
The following example shows how to find all Category objects from Oracle Knowledge repository by submitting a get request on the REST resource using cURL.
curl -X "GET" "http://IM_REST_API_HOST/km/api/latest/categories"
Example of Request Header
The following shows an example of the request header.
curl -X GET "https://<IM_REST_API_HOST>/km/api/latest/categories" -u "<username:password>" -H "Accept: application/json" -H "Content-Type: application/json"
Example of Response Body
The following example shows the contents of the response body in JSON format:
{ "items": [ { "recordId": "58921ED6778448CA8DF3D1C77336C332", "referenceKey": "FUSION_CATEGORY_300100163778925", "objectId": "029", "name": "BIQA_KM_TOP", "externalId": 300100163778925, "externalType": "CATEGORY", "description": "BIQA_KM_TOP", "links": [ { "rel": "children", "href": "https://<IM_REST_API_HOST>/km/api/v1/categories/58921ED6778448CA8DF3D1C77336C332/children", "mediaType": "application/json, application/xml", "method": "GET" }, { "rel": "canonical", "href": "https://<IM_REST_API_HOST>/km/api/v1/categories/58921ED6778448CA8DF3D1C77336C332", "mediaType": "application/json, application/xml", "method": "GET" }, { "rel": "collection", "href": "https://<IM_REST_API_HOST>/km/api/v1/categories", "mediaType": "application/json, application/xml", "method": "GET", "profile": "https://<IM_REST_API_HOST>/km/api/v1/metadata-catalog/categories" } ], "dateAdded": "2018-06-06T06:32:22+0000", "dateModified": "2018-06-06T06:32:23+0000", "sortOrder": 26, "hasChildren": true } ], "hasMore": true, "limit": 20, "offset": 0, "links": [ { "rel": "canonical", "href": "https://<IM_REST_API_HOST>/km/api/v1/categories?limit=20&offset=0", "mediaType": "application/json, application/xml", "method": "GET" }, { "rel": "next", "href": "https://<IM_REST_API_HOST>/km/api/v1/categories?limit=20&offset=20", "mediaType": "application/json, application/xml", "method": "GET" } ], "count": 1 }