Find all
/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.
This resource also supports the withParents request parameter.
When the withParents request parameter is set to true, for each category returned 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, and the views associated with the request.
Rules for Contact Users
If an interface ID is specified in the request, only entire branches of category or product trees where any item is associated with the Knowledge Advanced view mapped to the specified Oracle B2C Service interface will be returned.
Examples
Examples will reference the following product tree.
- Mobile (Associated with view V1 linked with interface ID 1)
- Phone
- Acme (Associated with view V2 linked to interface ID 2)
- Phone
- Camera (Associated with view V2 linked to interface ID 2)
- SLR
- Furniture (Associated with view V3 linked to interface ID 3)
- Living Room (Associated with view V1 linked to interface ID 1)
- Sofa
- Living Room (Associated with view V1 linked to interface ID 1)
- TV
- UHD
- SMART (Associated with view V1 linked to interface ID 1)
- UHD
Contact User Examples
GET http://<IM_REST_API_HOST>/km/api/latest/categories
The request specifies no interface ID so all products and categories will be returned.
GET http://<IM_REST_API_HOST>/km/api/latest/categories with interfaceId=1 specified in kmauthtoken
The request specifies interface ID 1 so all products and categories in any branch where any item is associated with view V1 will be returned. In this scenario the REST API will return Mobile, Phone, Acme, Furniture, Living Room, Sofa, TV, UHD, and SMART products.
Rules for Account Users
Unlike when using a contact user, when using an account user the user itself is associated with one or more views, so specifying interface ID is not relevant. Also, when using an account user the service does not always return an entire branch of a product/category tree, but instead will return any category or product associated with at least one view associated with the user, and all of that category or product's descendants.
Account User Examples
User assigned to V1.
GET http://<IM_REST_API_HOST>/km/api/latest/categories
The request was created using a user assigned to view V1, so all products associated with view V1 and their descendants will be returned. In this scenario the REST API will return Mobile, Phone, Acme, Living Room, Sofa, and SMART products.
User assigned to V1 and V2.
GET http://<IM_REST_API_HOST>/km/api/latest/categories
The request was created using a user assigned to views V1 and V2. All categories and products where they themselves, or any parent is associated with either view V1 or view V2 will be returned. In this scenario the REST API will return Mobile, Phone, Acme, Camera, SLR, Living Room, Sofa, and SMART products.
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?withParents=true
The request returns a list of Category objects in the Oracle Knowledge repository. For each category object, a list of parent categories that matches the visibility filtering rules are also included.
- 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.
Rules for Contact Users
In addition to the specified criteria:
If a content type is specified in the request, only entire branches of category or product trees where any item is associated with the content type will be returned.
If an interface ID is specified in the request, only entire branches of category or product trees where any item is associated with the Knowledge Advanced view mapped to the specified Oracle B2C Service interface will be returned.
If both a content type and an interface ID are specified in the request, only entire branches of category or product trees where any item is associated with the content type and any item is associated with the Knowledge Advanced view mapped to the specified Oracle B2C Service interface will be returned.
If the topLevelOnly parameter is specified as 'true', only the root of any branches that would otherwise be returned will be included. The topLevelOnly parameter defaults to 'false.'
Examples
Examples will reference the following product tree.
- Mobile (Associated with FAQ content type, and view V1 linked with interface ID 1)
- Phone
- Acme (Associated with view V2 linked to interface ID 2)
- Phone
- Camera (Associated with view V2 linked to interface ID 2)
- SLR (Associated with FAQ content type)
- Furniture (Associated with view V3 linked to interface ID 3)
- Living Room (Associated with view V1 linked to interface ID 1)
- Sofa
- Living Room (Associated with view V1 linked to interface ID 1)
- TV
- UHD (Associated with FAQ content type)
- SMART (Associated with view V1 linked to interface ID 1)
- UHD (Associated with FAQ content type)
Contact User Examples
GET http://<IM_REST_API_HOST>/km/api/latest/categories?q= externalType eq 'PRODUCT'
The request specifies no content type, no interface ID, nor topLevelOnly parameter so all products will be returned.
GET http://<IM_REST_API_HOST>/km/api/latest/categories?q= externalType eq 'PRODUCT' and topLevelOnly eq true
The request specifies no content type, no interface ID, but does set topLevelOnly parameter to 'true' so the top level of all branches will be returned. In this scenario the REST API will return Mobile, Camera, Furniture, and TV.
GET http://<IM_REST_API_HOST>/km/api/latest/categories?q= externalType eq 'PRODUCT' and contentTypeRefKey eq 'FAQ'
The request specifies content type as FAQ, but interface ID, and topLevelOnly parameter are not specified so all products in any branch where any product is associated with FAQ content type will be returned. In this scenario the REST API will return Using the above product tree this will be Mobile, Phone, Acme, Camera, SLR, TV, UHD, and SMART products.
GET http://<IM_REST_API_HOST>/km/api/latest/categories?q= externalType eq 'PRODUCT' and topLevelOnly eq true with interfaceId=1 specified in kmauthtoken
The request specifies no content type, but interface ID 1 is specified, and topLevelOnly parameter is set to 'true' so the top level product in any branch where any product is associated with view V1 will be returned. Using the above product tree this will In this scenario the REST API will returnbe Mobile, Furniture, and TV products.
GET http://<IM_REST_API_HOST>/km/api/latest/categories?q= externalType eq 'PRODUCT' and contentTypeRefKey eq 'FAQ' with interfaceId=2 specified in kmauthtoken
The request specifies content type as FAQ, interface ID 2, but topLevelOnly parameter is not specified so all products in any branch where any product is associated with FAQ content type and any product is associated with view V2 will be returned. In this scenario the REST API will return Using the above product tree this will be Mobile, Phone, Acme, Camera, and SLR products.
Rules for Account Users
Unlike when using a contact user, when using an account user the user itself is associated with one or more views, so specifying interface ID is not relevant. Also, when using an account user the service does not always return an entire branch of a product/category tree.
In addition to the specified criteria:
If no content type is specified in the request, only a category or product that is associated with at least one Knowledge Advanced view assigned to the account user and all of that category or product's descendants will be returned.
If a content type is specified in the request, only a category or product that is itself, or that has a parent associated with the content type and that is itself, or that has a parent associated with at least one Knowledge Advanced view assigned to the account user and all of that category or product's descendants will be returned.
If the topLevelOnly parameter is specified as 'true', only the topmost category or product for each branch that would otherwise be returned will be included. The topLevelOnly parameter defaults to 'false.'
Account User Examples
User assigned to V1.
GET http://<IM_REST_API_HOST>/km/api/latest/categories?q= externalType eq 'PRODUCT'
The request specifies no content type, nor topLevelOnly parameter and was created using a user assigned to view V1, so all products associated with view V1 and their descendants will be returned. In this scenario the REST API will return Mobile, Phone, Acme, Living Room, Sofa, and SMART products.
User assigned to V1.
GET http://<IM_REST_API_HOST>/km/api/latest/categories?q= externalType eq 'PRODUCT' and topLevelOnly eq true
The request specifies no content type, but does set topLevelOnly parameter to 'true' and was created using a user assigned to view V1, so the top product associated with V1 in each branch will be returned. In this scenario the REST API will return Mobile, Living Room, and SMART products.
User assigned to V1 and V2.
GET http://<IM_REST_API_HOST>/km/api/latest/categories?q= externalType eq 'PRODUCT' and contentTypeRefKey eq 'FAQ'
The request specifies content type as FAQ, but does not set topLevelOnly parameter and was created using a user assigned to views V1 and V2. All products where they themselves, or any parent is associated with FAQ content type and they themselves or any parent is associated with either view V1 or view V2 will be returned. In this scenario the REST API will return Mobile, Phone, Acme, SLR, and SMART products.
User assigned to V1 and V2.
GET http://<IM_REST_API_HOST>/km/api/latest/categories?q= externalType eq 'PRODUCT' and contentTypeRefKey eq 'FAQ' and topLevelOnly eq true
The request specifies content type as FAQ, and does set topLevelOnly parameter to 'true' and was created using a user assigned to views V1 and V2. This is identical to the previous example, but topLevelOnly is now 'true'. Of the products returned in the previous request, the top most in each branch will be returned in this request. In this scenario the REST API will return Mobile, SLR and SMART products.
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.
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.
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. |
objectId | Y | Y | 'type' : 'string' | The hierarchichal position of the category |
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: 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:
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: 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: 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: 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
-
allOf
Collection Paging Resource
Title:
Collection Paging Resource
Oracle base collection resource schema definition. -
object
ResultList CategoryData-allOf[1]
Collection Paging Resource
-
allOf
Base Collection Resource
Title:
Base Collection Resource
Oracle base collection resource schema definition. -
object
Collection Paging Resource-allOf[1]
Base Collection Resource
-
object
Singular Resource
Title:
Singular Resource
Oracle base singular resource schema definition. -
object
Base Collection Resource-allOf[1]
object
Singular Resource
object
-
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.
-
limit(optional):
integer
Actual paging size used by the server.
-
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
-
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
-
object
Singular Resource
Title:
Singular Resource
Oracle base singular resource schema definition. -
object
CategoryKey-allOf[1]
object
-
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.
-
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.
object
-
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.
-
hasChildren(optional):
boolean
Flag to determine if category has children.
-
sortOrder(optional):
integer
The assigned position of category object in the list of objects.
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
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 Command
Command: 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.
-H "kmauthtoken: {\"siteName\":\"ORACLE_KNOWLEDGE\",\"integrationUserToken\":\"\"+eCJYkxKwj5HUaIiJYun0/TpatwT1LmtcsF05W33xnEojifV/AsLDj9RpN0lKuorTMNKeSE1tgC7svVL+BzntqDON4KiM1HFlpxvXEUCB0P2w0Xrs75McygqxdVaDSE9"}" \ -H "Accept: application/json"
Example of Response Body
The following shows an example of the response body in JSON format.
{ "items" : [ { "dateAdded" : "2013-04-23T23:29:09EDT", "dateModified" : "2013-04-23T23:29:09EDT", "sortOrder" : 906385409, "description" : "DESCRIPTION_VALUE", "hasChildren" : false, "referenceKey" : "REFERENCEKEY_VALUE", "name" : "NAME_VALUE", "externalId" : 1428416790914, "externalType" : "EXTERNALTYPE_VALUE", "links" : [ { "rel" : "canonical", "href" : "http://<IM_REST_API_HOST>/km/api/{version}/{resourceURI}", "mediaType" : "application/json, application/xml", "templated" : true, "method" : "GET", "profile" : "http://<IM_REST_API_HOST>/km/api/{version}/metadata-catalog/{resourceName}" } ] } ], "hasMore" : false, "limit" : 20, "offset" : 0, "links" : [ { "rel" : "canonical", "href" : "http://<IM_REST_API_HOST>/km/api/{version}/categories?limit=20&offset=0", "mediaType" : "application/json, application/xml", "method" : "GET" } ], "count" : 1 }