QuickNav
Methods
createDeliveryClient(args) → {ContentDeliveryClient}
Create a delivery client to interact with content published
in Oracle Content Management. A delivery client can
- read published content items
- download published digital assets
- render published content using named content layouts
Parameters:
Name | Type | Description |
---|---|---|
args |
ClientParameters | A JavaScript object containing the parameters to create the content delivery client instance. |
Returns:
Example
import { createDeliveryClient } from '@oracle/content-management-sdk';
// create a delivery client and output logging 'info' messages to the console
var deliveryClient = createDeliveryClient({
contentServer: contentServer,
channelToken: channelToken,
logger: {
info: function (message) {
console.log(message);
}
}
});
createPreviewClient(args) → {ContentPreviewClient|ContentManagementClient}
Create a preview client to view draft (unpublished) content.
Preview clients can:
- read content types.
- read draft content items.
- render draft content using named content layouts.
- providing a beforeSend function to inject an Authorization header
- providing an Authorization header value via an authorization property of the arguments
- providing an authorizationParams object containing credentials to generate an OAuth token from the specified identity provider.
Parameters:
Name | Type | Description |
---|---|---|
args |
ClientParameters | A JavaScript object containing the parameters to create the content preview client instance. |
Returns:
Examples
import { createPreviewClient } from '@oracle/content-management-sdk';
// create a preview client (using preview REST API)
// and output logging 'info' messages to the console
var previewClient = createPreviewClient({
contentServer: contentServer,
channelToken: channelToken,
options: {
previewClientAPI: "previewREST",
},
authorizationParams: {
CLIENT_ID: "123456ABC",
CLIENT_SECRET: "7890123DEF",
CLIENT_SCOPE_URL: "https://<ServiceInstanceBaseURL>:443/urn:opc:cec:all",
IDP_URL: "https://idcs-123456.example.com",
},
logger: {
info: function (message) {
console.log(message);
}
}
});
import { createPreviewClient } from '@oracle/content-management-sdk';
// create a legacy preview client (using Management REST API)
// and output logging 'info' messages to the console
var previewClient = createPreviewClient({
contentServer: contentServer,
channelToken: channelToken,
authorization: 'Bearer A1234B5678C9012',
logger: {
info: function (message) {
console.log(message);
}
}
});
Type Definitions
ClientParameters
A JavaScript object containing the parameters to create the content client instance.
Type:
- object
Properties:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
contentServer |
string |
<optional> |
'protocol://host:port' | URL to the Oracle Content Management instance providing content. The default assumes the current 'protocol://host:port'. | ||||||||||||||||||||
contentVersion |
'v1' | 'v1.1' |
<optional> |
'v1.1' | The version of the content delivery REST API to use. | ||||||||||||||||||||
timeout |
string |
<optional> |
0 | Timeout for the AJAX calls, defaults to no timeout. | ||||||||||||||||||||
cacheBuster |
string |
<optional> |
The URL parameter used to control whether or not content is fetched from the browser cache. | |||||||||||||||||||||
secureContent |
boolean |
<optional> |
false | Content is secured and requires sign-in to view. | ||||||||||||||||||||
channelToken |
string | The Oracle Content Management instance token for accessing published content. | ||||||||||||||||||||||
authorization |
string |
<optional> |
Authorization header to include in the request. | |||||||||||||||||||||
options |
object |
<optional> |
define which family of REST API calls should be used to connect
to the Content server.
Properties
|
|||||||||||||||||||||
authorizationParams |
object |
<optional> |
Object containing application credentials. See https://docs.oracle.com/en/cloud/paas/content-cloud/solutions/integrate-oracle-content-management-using-oauth.html
Properties
|
|||||||||||||||||||||
beforeSend |
function |
<optional> |
Callback passing in the xhr (browser) or options (NodeJS) object before making the REST call. | |||||||||||||||||||||
logger |
object | An object that implements the standard log functions: ['error', 'warn', 'info', 'debug', 'log']. |
ContentInfo
Content Client Information
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
contentServer |
string | The URL to the server for content. |
clientType |
string | The type of content client ['delivery' | 'preview']. |
contentType |
string | Whether to access 'published' or 'draft' content. |
contentVersion |
string | The version of the Content Delivery REST API to use. |
channelToken |
string | The Oracle Content Management instance token for accessing published content. |
secureContent |
boolean | Content is secured and requires sign-in to view. |
authorization |
string | Authorization header to include in the request. |
beforeSend |
string | Callback passing in the xhr (browser) or options (node) object before making the REST call. |
timeout |
string | Default timeout for AJAX calls, which can be overridden on an individual call basis. |
cacheBuster |
string | Adds "cb={cacheBusterValue}" to the URL to enable distinct browser caching of GET requests. |