Get all categories

get

/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
  • The request returns a list of Category objects in the Oracle Knowledge repository, sorted by 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.




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.

Query Parameters

The following table describes the query parameters for this resource.

ParameterQueryableSortableTypeDescription
recordIdYY'type' : 'string'

The unique record ID of the Category object.

referenceKeyYY'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.

nameYY'type' : 'string'

The name of the category.

externalIdYY'type' : 'integer'

The unique identifier used while integrating the repository data with the external system.

externalTypeYY'type' : 'string'

The type of the category used while integrating the repository data with the external system. Valid options are PRODUCT and CATEGORY.

dateAddedYY'type' : 'string', 'format' : 'date-time'

The date when the Category object was created or added.

dateModifiedYY'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:

  • 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.

sortOrderYY'type' : 'integer'

The assigned position of category object in the list of objects.

topLevelOnlyYN'type' : 'boolean'Flag to return only top level categories.
contentTypeRefKeyYN'type' : 'string'This parameter is to filter categories by ContentType refKey.
contentTypeIdYN'type' : 'string'This parameter is to filter categories by ContentType recordid.
requiredYN'type' : 'boolean'This parameter is to filter categories if they are required or optional in ContentType.
childrenYN'$ref' : '#/definitions/ListCategoryKey'

The children or sub categories of the specific category.

parentYN'$ref' : '#/definitions/CategoryKey'

The parent category of the specific category.

Request

Query Parameters
  • 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.
  • 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" ]
  • 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.
  • 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.
  • 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.
Back to Top

Response

Supported Media Types

200 Response

OK.
Body ()
Root Schema : ResultList CategoryData
Type: object
Title: ResultList CategoryData
Show Source
Nested Schema : items
Type: array
Show Source
Nested Schema : CategoryData
Type: object
Title: CategoryData
Show Source
  • 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
  • The date when the Category object was created or added.

  • 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 of the Category object
  • The unique identifier used while integrating the repository data with the external system.

  • The type of the category used while integrating the repository data with the external system. Valid options are PRODUCT and CATEGORY.

  • Flag to determine if category has children.
  • The inventory organization id of the specific product.

  • links
  • The name of the category.

  • The hierarchichal position of the category
  • 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
  • The unique record ID of the Category object.

  • 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.

  • 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.

  • The assigned position of category object in the list of objects.

Nested Schema : parents
Type: 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
Show Source
Nested Schema : CategoryKey
Type: object
Title: CategoryKey
Show Source
  • 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 of the Category object
  • The unique identifier used while integrating the repository data with the external system.

  • The type of the category used while integrating the repository data with the external system. Valid options are PRODUCT and CATEGORY.

  • The inventory organization id of the specific product.

  • links
  • The name of the category.

  • The hierarchichal position of the category
  • 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
  • The unique record ID of the Category object.

  • 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.

  • 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.

Nested Schema : parents
Type: 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
Show Source
Back to Top

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
}
Back to Top