Update
/km/api/v1/replacementTokens/{id}
This method updates the ReplacementToken object (with the specified unique identifier parameter) for the specified Locale. Unique identifiers of ReplacementToken objects include the recordId and tokenName.
You can specify the Locale by setting the localeId parameter of the kmauthtoken header when making requests to the Oracle Knowledge REST API. Alternatively, if no localeId parameter value is specified, then the method interprets the specified Locale as the default Locale object assigned to the logged in user. In both the cases, the specified Locale is referred to as the session's Locale. The logged in user is the user for which the userToken attribute on the kmauthtoken header was created. Additionally, the Locale can be specified by the Accept-Language header value or by the langpref request parameter. In both the cases, we refer to specified Locale as the request's Locale. If both the Accept-Language header and the langpref request parameter are present, the Accept-Language header is used as the specified Locale.
The tokenType indicates the type of UI text editor used to update the ReplacementToken object. If the ReplacementToken object is updated with a rich text editor, then the tokenType must be set to RICH_TEXT. If the ReplacementToken object is updated with a plain text editor, then the tokenType should be set to PLAIN_TEXT.
NOTE: The software will not validate and/or correct the HTML contained in the replacement text when the ReplacementToken object is being updated with a rich text editor and the tokenType is set to RICH_TEXT.
NOTE: The '.' character is a reserved character used internally by the system and should not be used in the tokenName. Using the '.' character can result in errors during substitution of the replacement text.
Example URIs
The example URIs for this method are as follows:
http://<IM_REST_API_HOST>/km/api/latest/replacementTokens/{id}
The request creates or updates the translation of the replacement text for the session's Locale for the ReplacementToken object having the specified recordId.
http://<IM_REST_API_HOST>/km/api/latest/replacementTokens/{id}?langpref=es_ES
The request creates or updates the translation of the replacement text for the request's locale, specified as Spanish, for the ReplacementToken object having the specified recordId parameter value.
http://<IM_REST_API_HOST>/km/api/latest/replacementTokens/{id}
, with Accept-Language header valueit-IT
The request creates or updates the translation of the replacement text for the request's locale, specified as Italian, for the ReplacementToken object having the specified recordId parameter value.
http://<IM_REST_API_HOST>/km/api/latest/replacementTokens/{tokenName}
The request creates or updates the translation of the replacement text for the session's locale for the ReplacementToken object having the specified tokenName parameter value.
http://<IM_REST_API_HOST>/km/api/latest/replacementTokens/{tokenName}?langpref=es_ES
The request creates or updates the translation of the replacement text for the request's locale, specified as Spanish, for the ReplacementToken object having the specified tokenName parameter value.
http://<IM_REST_API_HOST>/km/api/latest/replacementTokens/{tokenName}, with Accept-Language header value 'it-IT'
The request creates or updates the translation of the replacement text for the request's locale, specified as Italian, for the ReplacementToken object having the specified tokenName parameter value.
Response Errors
The possible error responses for this method are as follows:
- OK-GEN0005
This error is displayed when the tokenType parameter value is not specified.
- OKDOM-GEN0006
This error is displayed when the tokenType parameter value is specified as anything other than RICH_TEXT or PLAIN_TEXT.
- OK-GEN0012
This error is displayed when the tokenName parameter has been modified.
Request
- application/json
- application/xml
-
id: string
The unique identifier of the object to be updated.
-
object
Singular Resource
Title:
Singular Resource
Oracle base singular resource schema definition. -
object
ReplacementTokenKey-allOf[1]
object
Singular Resource
object
-
recordId(optional):
string
The replacement token's record Id.
-
tokenName(optional):
string
The replacement token's name.
object
-
dateAdded(optional):
string(date-time)
The date added for the replacement token for the specified locale.
-
dateModified(optional):
string(date-time)
The date modified for the replacement token for the specified locale.
-
replacementText(optional):
string
The HTML formatted replacement text.
-
replacementTextNonFormatted(optional):
string
The non-HTML formatted replacement text.
-
tokenType(optional):
string
The token type of the token. Used to specify what kind of text editor was used to create/edit this token: rich text('RICH_TEXT') or plain text('PLAIN_TEXT').
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.
Response
- application/json
- application/xml
200 Response
-
object
Singular Resource
Title:
Singular Resource
Oracle base singular resource schema definition. -
object
ReplacementTokenKey-allOf[1]
object
Singular Resource
object
-
recordId(optional):
string
The replacement token's record Id.
-
tokenName(optional):
string
The replacement token's name.
object
-
dateAdded(optional):
string(date-time)
The date added for the replacement token for the specified locale.
-
dateModified(optional):
string(date-time)
The date modified for the replacement token for the specified locale.
-
replacementText(optional):
string
The HTML formatted replacement text.
-
replacementTextNonFormatted(optional):
string
The non-HTML formatted replacement text.
-
tokenType(optional):
string
The token type of the token. Used to specify what kind of text editor was used to create/edit this token: rich text('RICH_TEXT') or plain text('PLAIN_TEXT').
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.
Examples
The following example shows how to update the Replacement Token object with the specified ID parameter for the specified locale by submitting a put request on the REST resource using cURL.
cURL Command
curl -X "PUT" "http://<IM_REST_API_HOST>/km/api/latest/replacementTokens/{id}"
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.
{ "dateAdded" : "2013-04-30T21:35:18EDT", "dateModified" : "2013-04-30T21:35:18EDT", "replacementText" : "\n \t<p><a href=\"http://www.oracle.com/us/products/applications/knowledge-management/index.html\">Oracle Knowledge</a></p>\n\t\t<p> </p>\n\t", "replacementTextNonFormatted" : "Oracle Knowledge", "tokenType" : "RICH_TEXT", "recordId" : "0121040772e9a860142e278b51501243", "tokenName" : "ORACLE_KNOWLEDGE", "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}" } ] }
Example of Response Body
The following shows an example of the response body in JSON format.
{ "dateAdded" : "2013-04-30T21:35:18EDT", "dateModified" : "2013-04-30T21:35:18EDT", "replacementText" : "\n \t<p><a href=\"http://www.oracle.com/us/products/applications/knowledge-management/index.html\">Oracle Knowledge</a></p>\n\t\t<p> </p>\n\t", "replacementTextNonFormatted" : "Oracle Knowledge", "tokenType" : "RICH_TEXT", "recordId" : "0121040772e9a860142e278b51501243", "tokenName" : "ORACLE_KNOWLEDGE", "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}" } ] }