Add subscription

post

/km/api/v1/users/{id}/subscriptions

This method creates a new user subscription for a specified user ID.

You can create either a Content-based or ContentType-based subscription for a specified user. For ContentType-based subscription, you can optionally specify one or more categories to restrict the content of your subscription.

Note: The logged in user must have the MODIFY_USER or MODIFY_WEB_USER privileges to create a subscription for another user.


Response Errors

The possible error responses for this method are as follows:

  • OK-SEC0001

    The error occurs when a user does not have the MODIFY_USER or MODIFY_WEB_USER privileges but attempts to create a subscription for another user.

  • OKDOM-GEN0001

    The error occurs when a userId, content versionId for content based subscriptions, or contentType recordId for contentType based subscriptions do not exist.

  • OK-GEN0006

    The error occurs when a recordId, dateadded, datemodified, lastCrawl, or subscriptionType values are specified with the request.

  • OK-GEN0005

    The error occurs when a subscription name is not set in the request.

  • OKDOM-USER0015

    The error occurs when the specified userId value in the request does not match the userId value specified in the Business Object.

  • OKDOM-USER0017

    The error occurs when both content and contentType are set on the Business Object.

  • OKDOM-USER0018

    The error occurs when both content and categories are set on the Business Object.

  • OKDOM-USER0016

    The error occurs when neither content nor contentType are set on the Business Object.

  • OKDOM-USER0019

    The error occurs in one of the following instances:

    • A content-based subscription already exists for the same content and locale.
    • A ContentType-based subscription already exists for contenType set on the Business Object.
  • OKDOM-USER0020

    The error occurs when a category in Business Object is not assigned to the contentType being used.

Request

Supported Media Types
Path Parameters
Body ()
The subscription to be added
Root Schema : Subscription
Match All
Show Source
Nested Schema : SubscriptionData
Match All
Show Source
Nested Schema : SubscriptionKey
Match All
Show Source
Nested Schema : Singular Resource
Type: object
Title: Singular Resource
Oracle base singular resource schema definition.
Show Source
Nested Schema : SubscriptionKey-allOf[1]
Type: object
Show Source
Nested Schema : SubscriptionData-allOf[1]
Type: object
Show Source
Nested Schema : Subscription-allOf[1]
Type: object
Show Source
Nested Schema : categories
Type: array
To Many Relationship to Category
Show Source
Nested Schema : ContentKey
Match All
Show Source
Nested Schema : ContentTypeKey
Match All
Show Source
Nested Schema : UserKey
Match All
Show Source
Nested Schema : CategoryKey
Match All
Show Source
Nested Schema : CategoryKey-allOf[1]
Type: object
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 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
Nested Schema : ContentKey-allOf[1]
Type: object
Show Source
Nested Schema : allTranslations
Type: array

This field will return list of all translated content that the user can view

This field will only be populated if allTranslations query parameter is passed in with value true.

Show Source
Nested Schema : LocaleKey
Match All
Show Source
Nested Schema : LocaleKey-allOf[1]
Type: object
Show Source
Nested Schema : ContentTypeKey-allOf[1]
Type: object
Show Source
  • The description for the ContentType object. Content Types support multiple languages.

    This field identifies the object associated with the language specified by the user.

  • The name for the ContentType object. The name field can only be used for sorting.

    Content Types support multiple languages. This field identifies the object associated with the language specified by the user.

  • The unique identifier of the ContentType object.

  • The reference key for the ContentType object.

    ContentType objects support multiple languages. This field can be used to identify the associated objects for all languages.

Nested Schema : UserKey-allOf[1]
Type: object
Show Source
Back to Top

Response

Supported Media Types

201 Response

Created.
Body ()
Root Schema : Subscription
Match All
Show Source
Nested Schema : SubscriptionData
Match All
Show Source
Nested Schema : SubscriptionKey
Match All
Show Source
Nested Schema : Singular Resource
Type: object
Title: Singular Resource
Oracle base singular resource schema definition.
Show Source
Nested Schema : SubscriptionKey-allOf[1]
Type: object
Show Source
Nested Schema : SubscriptionData-allOf[1]
Type: object
Show Source
Nested Schema : Subscription-allOf[1]
Type: object
Show Source
Nested Schema : categories
Type: array
To Many Relationship to Category
Show Source
Nested Schema : ContentKey
Match All
Show Source
Nested Schema : ContentTypeKey
Match All
Show Source
Nested Schema : UserKey
Match All
Show Source
Nested Schema : CategoryKey
Match All
Show Source
Nested Schema : CategoryKey-allOf[1]
Type: object
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 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
Nested Schema : ContentKey-allOf[1]
Type: object
Show Source
Nested Schema : allTranslations
Type: array

This field will return list of all translated content that the user can view

This field will only be populated if allTranslations query parameter is passed in with value true.

Show Source
Nested Schema : LocaleKey
Match All
Show Source
Nested Schema : LocaleKey-allOf[1]
Type: object
Show Source
Nested Schema : ContentTypeKey-allOf[1]
Type: object
Show Source
  • The description for the ContentType object. Content Types support multiple languages.

    This field identifies the object associated with the language specified by the user.

  • The name for the ContentType object. The name field can only be used for sorting.

    Content Types support multiple languages. This field identifies the object associated with the language specified by the user.

  • The unique identifier of the ContentType object.

  • The reference key for the ContentType object.

    ContentType objects support multiple languages. This field can be used to identify the associated objects for all languages.

Nested Schema : UserKey-allOf[1]
Type: object
Show Source
Back to Top

Examples

Example 1

The following example shows how to create a content subscription for a specified user ID by submitting a post request on the REST resource using cURL.

cURL Command

curl -X "POST" "http://<IM_REST_API_HOST>/km/api/latest/users/{id}/subscriptions"

Example of Request Header

The following shows an example of the request header.

-H "kmauthtoken: {\"siteName\":\"ORACLE_KNOWLEDGE\",\"integrationUserToken\":\"\"+eCJYkxKwj5HUaIiJYun0/TpatwT1LmtcsF05W33xnEojifV/AsLDj9RpN0lKuorTMNKeSE1tgC7svVL+BzntqDON4KiM1HFlpxvXEUCB0P2w0Xrs75McygqxdVaDSE9",\"userToken\":\"UoyWTKRG4RpyJCH4Wqjzht2iYUrsDdk5ir+3IpwEkxcwajJkGR9OGSQBTANQVGW0iVT9MFeDzqL+RYdgfzGSK+h5QzDFIDM+rDLgdKeEE19ljWFm3zMCF+kgYp/dJ/Yq5V7Re+aDXqHg6YkHfvprFA==\"}" \
-H "Accept: application/json"

Example of Request Body

The following shows an example of the request body in JSON format.

{
  "content" : {
    "versionId" : "VERSIONID_VALUE"
  },
  "active" : true,
  "name" : "NAME_VALUE"
}

Example of Response Body

The following shows an example of the response body in JSON format.

{
  "contentType" : {
    "referenceKey" : "REFERENCEKEY_VALUE",
    "name" : "NAME_VALUE",
    "links" : [ {
      "rel" : "canonical",
      "href" : "http://<IM_REST_API_HOST>/api/{version}/{resourceURI}",
      "mediaType" : "application/json, application/xml",
      "templated" : true,
      "method" : "GET",
      "profile" : "http://<IM_REST_API_HOST>/api/{version}/metadata-catalog/{resourceName}"
    } ]
  },
  "content" : {
    "versionId" : "VERSIONID_VALUE",
    "documentId" : "DOCUMENTID_VALUE",
    "title" : "TITLE_VALUE",
    "version" : "VERSION_VALUE",
    "links" : [ {
      "rel" : "canonical",
      "href" : "http://<IM_REST_API_HOST>/api/{version}/{resourceURI}",
      "mediaType" : "application/json, application/xml",
      "templated" : true,
      "method" : "GET",
      "profile" : "http://<IM_REST_API_HOST>/api/{version}/metadata-catalog/{resourceName}"
    } ]
  },
  "owner" : {
    "name" : "NAME_VALUE",
    "externalId" : 1428417269295,
    "externalType" : "EXTERNALTYPE_VALUE",
    "links" : [ {
      "rel" : "canonical",
      "href" : "http://<IM_REST_API_HOST>/api/{version}/{resourceURI}",
      "mediaType" : "application/json, application/xml",
      "templated" : true,
      "method" : "GET",
      "profile" : "http://<IM_REST_API_HOST>/api/{version}/metadata-catalog/{resourceName}"
    } ]
  },
  "categories" : [ {
    "referenceKey" : "REFERENCEKEY_VALUE",
    "name" : "NAME_VALUE",
    "externalId" : 1428417269305,
    "externalType" : "EXTERNALTYPE_VALUE",
    "links" : [ {
      "rel" : "canonical",
      "href" : "http://<IM_REST_API_HOST>/api/{version}/{resourceURI}",
      "mediaType" : "application/json, application/xml",
      "templated" : true,
      "method" : "GET",
      "profile" : "http://<IM_REST_API_HOST>/api/{version}/metadata-catalog/{resourceName}"
    } ]
  } ],
  "links" : [ {
    "rel" : "canonical",
    "href" : "http://<IM_REST_API_HOST>/api/{version}/{resourceURI}",
    "mediaType" : "application/json, application/xml",
    "templated" : true,
    "method" : "GET"
  } ],
  "active" : true,
  "dateAdded" : "2013-04-30T14:37:11-0600",
  "dateModified" : "2013-04-30T14:37:11-0600",
  "lastCrawl" : "2013-04-30T14:37:11-0600",
  "name" : "NAME_VALUE",
  "subscriptionType" : "SUBSCRIPTIONTYPE_CONTENT"
}

Example 2

The following example shows how to create a content-type subscription for a specified user ID by submitting a post request on the REST resource using cURL.

cURL Command

curl -X "POST" "http://<IM_REST_API_HOST>/km/api/latest/users/{id}/subscriptions"

Example of Request Header

The following shows an example of the request header.

-H "kmauthtoken: {\"siteName\":\"ORACLE_KNOWLEDGE\",\"integrationUserToken\":\"\"+eCJYkxKwj5HUaIiJYun0/TpatwT1LmtcsF05W33xnEojifV/AsLDj9RpN0lKuorTMNKeSE1tgC7svVL+BzntqDON4KiM1HFlpxvXEUCB0P2w0Xrs75McygqxdVaDSE9",\"userToken\":\"UoyWTKRG4RpyJCH4Wqjzht2iYUrsDdk5ir+3IpwEkxcwajJkGR9OGSQBTANQVGW0iVT9MFeDzqL+RYdgfzGSK+h5QzDFIDM+rDLgdKeEE19ljWFm3zMCF+kgYp/dJ/Yq5V7Re+aDXqHg6YkHfvprFA==\"}" \
-H "Accept: application/json"

Example of Request Body

The following shows an example of the request body in JSON format.

{
  "contentType" : {
    "recordId" : "01234567890A",
     "referenceKey" : "REFERENCEKEY_VALUE",
     "name" : "NAME_VALUE"
  },
  "active" : true,
  "name" : "NAME_VALUE"
}

Example of Response Body

The following shows an example of the response body in JSON format.

{
  "contentType" : {
    "referenceKey" : "REFERENCEKEY_VALUE",
    "name" : "NAME_VALUE",
    "links" : [ {
      "rel" : "canonical",
      "href" : "http://<IM_REST_API_HOST>/api/{version}/{resourceURI}",
      "mediaType" : "application/json, application/xml",
      "templated" : true,
      "method" : "GET",
      "profile" : "http://<IM_REST_API_HOST>/api/{version}/metadata-catalog/{resourceName}"
    } ]
  },
  "owner" : {
    "name" : "NAME_VALUE",
    "externalId" : 1428417269295,
    "externalType" : "EXTERNALTYPE_VALUE",
    "links" : [ {
      "rel" : "canonical",
      "href" : "http://<IM_REST_API_HOST>/api/{version}/{resourceURI}",
      "mediaType" : "application/json, application/xml",
      "templated" : true,
      "method" : "GET",
      "profile" : "http://<IM_REST_API_HOST>/api/{version}/metadata-catalog/{resourceName}"
    } ]
  },
  "categories" : [ {
    "referenceKey" : "REFERENCEKEY_VALUE",
    "name" : "NAME_VALUE",
    "externalId" : 1428417269305,
    "externalType" : "EXTERNALTYPE_VALUE",
    "links" : [ {
      "rel" : "canonical",
      "href" : "http://<IM_REST_API_HOST>/api/{version}/{resourceURI}",
      "mediaType" : "application/json, application/xml",
      "templated" : true,
      "method" : "GET",
      "profile" : "http://<IM_REST_API_HOST>/api/{version}/metadata-catalog/{resourceName}"
    } ]
  } ],
  "links" : [ {
    "rel" : "canonical",
    "href" : "http://<IM_REST_API_HOST>/api/{version}/{resourceURI}",
    "mediaType" : "application/json, application/xml",
    "templated" : true,
    "method" : "GET"
  } ],
  "active" : true,
  "dateAdded" : "2013-04-30T14:37:11-0600",
  "dateModified" : "2013-04-30T14:37:11-0600",
  "lastCrawl" : "2013-04-30T14:37:11-0600",
  "name" : "NAME_VALUE",
  "subscriptionType" : "SUBSCRIPTIONTYPE_CONTENT"
}
Back to Top