Create

post

/km/api/v1/users/{userId}/userKeyValues

This method creates a UserKeyValue object in the Oracle Knowledge repository.

The UserKeyValue object can be used to represent a relationship between a user and an object. For example, a UserKeyValue object can be used to store user's favorite documents whi using a REST API consuming web application.


Example URI

The example URI for this method is as follows:

  • http://<IM_REST_API_HOST>/km/api/latest/users/{userId}/userKeyValues

    This request creates a new UserKeyValue object in the Oracle Knowledge repository.

Response Errors

The possible error responses for this method are as follows:

  • OK-GEN0005

    The error occurs in either of the following cases:

    • A user record for the specified ID does not exist.
    • The parameter values of userKeyValue.key, userinformation, or userinformation.reocrdId are null.

  • OKDOM-USERKV0001

    The error occurs when a user already has an existing UserKeyValue with the same specified key.

  • OKDOM-USERKV0002

    The error occurs when the specified user record Id does not match the userinformation.recordId parameter value.

Request

Supported Media Types
Body ()
The object to be created.
Root Schema : UserKeyValue
Match All
Show Source
Nested Schema : UserKeyValueData
Match All
Show Source
Nested Schema : UserKeyValueKey
Match All
Show Source
Nested Schema : Singular Resource
Type: object
Title: Singular Resource
Oracle base singular resource schema definition.
Show Source
Nested Schema : UserKeyValueKey-allOf[1]
Type: object
Show Source
Nested Schema : UserKeyValueData-allOf[1]
Type: object
Show Source
Nested Schema : UserKeyValue-allOf[1]
Type: object
Show Source
Nested Schema : UserKey
Match All
Show Source
Nested Schema : UserKey-allOf[1]
Type: object
Show Source
Back to Top

Response

Supported Media Types

201 Response

Created.
Body ()
Root Schema : UserKeyValue
Match All
Show Source
Nested Schema : UserKeyValueData
Match All
Show Source
Nested Schema : UserKeyValueKey
Match All
Show Source
Nested Schema : Singular Resource
Type: object
Title: Singular Resource
Oracle base singular resource schema definition.
Show Source
Nested Schema : UserKeyValueKey-allOf[1]
Type: object
Show Source
Nested Schema : UserKeyValueData-allOf[1]
Type: object
Show Source
Nested Schema : UserKeyValue-allOf[1]
Type: object
Show Source
Nested Schema : UserKey
Match All
Show Source
Nested Schema : UserKey-allOf[1]
Type: object
Show Source
Back to Top

Examples

The following example shows how to create a User Key Value object in Oracle Knowledge repository 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/{userId}/userKeyValues"

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.

{
  "userInformation" : {
    "recordId" : "DB1A8D3A77434710A57D0E061FE3D18E",
    "name" : "John Smith",
    "externalType" : "CONTACT"
  },
  "key" : "FAVORITES",
  "value" : "FAQ1,FAQ23,FAQ44"
}

Example of Response Header

The following shows an example of the response header.

{
  "userInformation" : {
    "recordId" : "048016503b35e6fc0144e01818e2007b87",
    "name" : "John Smith",
    "externalId" : 12345,
    "externalType" : "CONTACT",
    "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}"
    } ]
  },
  "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}"
  } ],
  "dateAdded" : "2013-04-23T21:06:43EDT",
  "dateModified" : "2013-04-23T21:06:43EDT",
  "key" : "FAVORITES",
  "value" : "FAQ1,FAQ23,FAQ44"
}
Back to Top