Libraries resource (Data API 19.10)

Summary

Http Method Resource Description
GET /libraries/{library_id}/content/{content_id} Returns a content asset using the specified ID. If the content asset cannot be found, the server returns a 404 (ContentNotFoundException) fault. If the connection is not secure, the server returns a 403 (SecureCommunicationRequiredException).
PUT /libraries/{library_id}/content/{content_id} Creates a new content asset in the specified library, or overwrites an existing content asset. If a content asset with the specified ID already exists, the server completely overwrites the content asset. Please note: Existing folder assignments are not touched. If the existing content asset is locked, the server returns a 409 (ResourceLockedException) fault. If the connection is not secure, the server returns a 403 (SecureCommunicationRequiredException) fault.
DELETE /libraries/{library_id}/content/{content_id} Deletes the content asset with the specified ID from the specified library. If the content asset is not found, the server returns a 404 (NotFoundException) fault. If the content asset is locked by another user, the server returns a 409 (ResourceLockedException) fault. If the connection is not secure, the server returns a 403 (SecureCommunicationRequiredException) fault.
PATCH /libraries/{library_id}/content/{content_id} Updates a content asset. In the request, the If-Match header is required. The value of the header is an 'ETag' representing the last known base-point information for the content asset. If the header is missing, the server returns a 409 (IfMatchRequiredException) fault. If the header value does not match the server's 'ETag', the server returns a 412 (InvalidIfMatchException) fault. The delta information for the library folder containing the content asset is updated atomically: the information is written completely or not at all. If the content asset is locked, the server returns a 409 (ResourceLockedException) fault.
GET /libraries/{library_id}/content/{content_id}/folders Action to get all assigned folders of a content asset.
GET /libraries/{library_id}/folder_assignments/{content_id}/{folder_id} Action to get a single content to folder assignment
PUT /libraries/{library_id}/folder_assignments/{content_id}/{folder_id} Action to assign a content asset to a specified folder.
DELETE /libraries/{library_id}/folder_assignments/{content_id}/{folder_id} Action to unassign a content asset from the specified library folder.
PATCH /libraries/{library_id}/folder_assignments/{content_id}/{folder_id} Action to update a single content to folder assignment. Currently only the position and default attribute can be changed.
GET /libraries/{library_id}/folders/{folder_id} Action to get folder information.
PUT /libraries/{library_id}/folders/{folder_id} Action to create a new library folder, or to replace an existing folder. This action completely overwrites existing folders. Please note: Sub folders and assignments to content assets are not touched. This action ignores the folder ID in the input document.
DELETE /libraries/{library_id}/folders/{folder_id} Delete folder
PATCH /libraries/{library_id}/folders/{folder_id} Updates an existing folder. In the request, the If-Match header is required. The value of the header is an 'ETag' representing the last known base-point information for the library folder. If the header is missing, the server returns a 409 (IfMatchRequiredException) fault. If the header value does not match the server's 'ETag', the server returns a 412 (InvalidIfMatchException) fault. The delta information for the library folder is updated atomically: the information is written completely or not at all.
GET /libraries/{library_id}/folders/{folder_id}/content Action to get all assigned content assets of a folder.
GET /libraries/{library_id}/folders/{folder_id}/sub_folders Action to get sub folders information.

Get content asset.

Returns a content asset using the specified ID. If the content asset cannot be found, the server returns a 404 (ContentNotFoundException) fault. If the connection is not secure, the server returns a 403 (SecureCommunicationRequiredException).

Url

GET https://hostname:port/dw/data/v19_10/libraries/{library_id}/content/{content_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Response Document

ContentAsset

Path Parameters

Parameter Type Description Constraints
content_id String the ID of the content asset to retrieve. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 ContentNotFoundException

libraryId (String)

contentId (String)

Indicates that the content asset with the given id is unknown.

Sample

REQUEST:
GET /s/-/dw/data/v19_10/libraries/SiteGenesis/content/account-banner HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8

# in case of success:

RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
  "_v":"19.10",
  "_resource_state" : "847f9c3c5867f641470b3046aeec31f07757991b792d722e10079926f7a289fb",
  "_type":"content_asset",
  "id" : "account-banner",
  "name":
  {
    "default":"My Account Banner"
  },
  "description":
  {
    "default":"Global My Account Banner"
  },
  "online":
  {
    "default":false
  },
  "searchable":
  {
    "default":false
  },
  "site_map_change_frequency":
  {
    "default":"never"
  },
  "site_map_included":
  {
    "default":0
  },
  "site_map_priority":
  {
    "default":0.0
  }
  "c_body":"<p>This is a body.</p>"
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
  "_type" : "fault",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with ID 'account-banner' in library 'SiteGenesis' was found."
  }
}

Create content asset

Creates a new content asset in the specified library, or overwrites an existing content asset. If a content asset with the specified ID already exists, the server completely overwrites the content asset. Please note: Existing folder assignments are not touched. If the existing content asset is locked, the server returns a 409 (ResourceLockedException) fault. If the connection is not secure, the server returns a 403 (SecureCommunicationRequiredException) fault.

Url

PUT https://hostname:port/dw/data/v19_10/libraries/{library_id}/content/{content_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

ContentAsset

Response Document

ContentAsset

Path Parameters

Parameter Type Description Constraints
content_id String the ID of the content asset to retrieve. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 IdConflictException

bodyID (String)

urlID (String)

Indicates that the ID from the request body doesn't match the URL-Id.
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 ContentNotFoundException

libraryId (String)

contentId (String)

Indicates that the content asset with the given id is unknown.
412 ResourceLockedException

componentName (String)

id (String)

Indicates that the ID from the request body doesn't match the URL-Id.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.data.content.content.beforeCreate

beforeCreate (library : Library , create : ContentAsset ) : Status

The function is called before the content asset is created with the given document.

Parameters:
library - the library in the actual context
create - the content asset create document.
Returns:
a non-null Status ends the hook execution
dw.ocapi.data.content.content.afterCreate

afterCreate (library : Library , content : Content , create : ContentAsset ) : Status

The function is called after the new content asset was created.

Parameters:
library - the library in the actual context
content - the new content asset.
create - the content asset create document.
Returns:
a non-null Status ends the hook execution

Sample

REQUEST:
PUT /s/-/dw/data/v19_10/libraries/SiteGenesis/content/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8
{
  "name":
  {
    "default":"About Us"
  },
  "page_title":
  {
    "default":"Page Title"
  },
  "page_description":
  {
    "default":"Page Description"
  },
  "page_keywords":
  {
    "default":"Keyword1"
  },
  "page_url":
  {
    "default":"default.ocapi.net"
  },
  "online":
  {
    "default":false
  },
  "searchable":
  {
    "default":false
  },
  "template":"template1",
  "site_map_change_frequency":
  {
    "default":"never"
  },
  "site_map_included":
  {
    "default":0
  },
  "site_map_priority":
  {
    "default":0.5
  }
  "c_body":"<p>This is the about us body.</p>"
}

# in case of success:
 
RESPONSE:
HTTP/1.1 201 CREATED
Location: https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/content/about-us
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
  "_v":"19.10",
  "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
  "_type":"content_asset",
  "id" : "about-us",
  "name":
  {
    "default":"About Us"
  },
  "page_title":
  {
    "default":"Page Title"
  },
  "page_description":
  {
    "default":"Page Description"
  },
  "page_keywords":
  {
    "default":"Keyword1"
  },
  "page_url":
  {
    "default":"default.ocapi.net"
  },
  "online":
  {
    "default":false
  },
  "searchable":
  {
    "default":false
  },
  "template":"template1",
  "site_map_change_frequency":
  {
    "default":"never"
  },
  "site_map_included":
  {
    "default":0
  },
  "site_map_priority":
  {
    "default":0.5
  }
  "c_body":"<p>This is the about us body.</p>"
}
 
# in case of library not found:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type":"fault",
  "fault":
  {
    "type":"LibraryNotFoundException",
    "message":"No library with ID 'SiteGenesis' was found."
  }
}

Delete content asset.

Deletes the content asset with the specified ID from the specified library. If the content asset is not found, the server returns a 404 (NotFoundException) fault. If the content asset is locked by another user, the server returns a 409 (ResourceLockedException) fault. If the connection is not secure, the server returns a 403 (SecureCommunicationRequiredException) fault.

Url

DELETE https://hostname:port/dw/data/v19_10/libraries/{library_id}/content/{content_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Path Parameters

Parameter Type Description Constraints
content_id String the ID of the content asset to remove. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 ContentNotFoundException

libraryId (String)

contentId (String)

Indicates that the content asset with the given id is unknown.
412 ResourceLockedException

componentName (String)

id (String)

Indicates that the ID from the request body doesn't match the URL-Id.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.data.content.content.beforeDelete

beforeDelete (library : Library , content : Content ) : Status

The function is called before the content asset is deleted.

Parameters:
library - the library in the actual context
content - the content asset to be deleted.
Returns:
a non-null Status ends the hook execution
dw.ocapi.data.content.content.afterDelete

afterDelete (library : Library ) : Status

The function is called after the content asset was deleted.

Parameters:
library - the library in the actual context
Returns:
a non-null Status ends the hook execution

Sample

REQUEST:
DELETE /s/-/dw/data/v19_10/libraries/SiteGenesis/content/account-banner HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8
x-dw-resource-state: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5

# in case of success:
 
RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type" : "fault",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with ID 'account-banner' in library 'SiteGenesis' was found."
  }
}

Update content asset.

Updates a content asset. In the request, the If-Match header is required. The value of the header is an 'ETag' representing the last known base-point information for the content asset. If the header is missing, the server returns a 409 (IfMatchRequiredException) fault. If the header value does not match the server's 'ETag', the server returns a 412 (InvalidIfMatchException) fault. The delta information for the library folder containing the content asset is updated atomically: the information is written completely or not at all. If the content asset is locked, the server returns a 409 (ResourceLockedException) fault.

Url

PATCH https://hostname:port/dw/data/v19_10/libraries/{library_id}/content/{content_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

ContentAsset

Response Document

ContentAsset

Path Parameters

Parameter Type Description Constraints
content_id String the ID of the content asset to retrieve. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 ContentIdAlreadyInUseException

contentId (String)

Indicates that a content asset with the ID to change to is already existing.
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 ContentNotFoundException

libraryId (String)

contentId (String)

Indicates that the content asset with the given id is unknown.
412 ResourceLockedException

componentName (String)

id (String)

Indicates that the ID from the request body doesn't match the URL-Id.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.data.content.content.beforeUpdate

beforeUpdate (library : Library , content : Content , update : ContentAsset ) : Status

The function is called before the content asset is updated with update document.

Parameters:
library - the library in the actual context
content - the content asset to update.
update - the update document.
Returns:
a non-null Status ends the hook execution
dw.ocapi.data.content.content.afterUpdate

afterUpdate (library : Library , content : Content , update : ContentAsset ) : Status

The function is called after the content asset is updated with update document.

Parameters:
library - the library in the actual context
content - the content asset to update.
update - the update document.
Returns:
a non-null Status ends the hook execution

Sample

REQUEST:
PATCH /s/-/dw/data/v19_10/libraries/SiteGenesis/content/account-banner HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
{
  "_resource_state" : "847f9c3c5867f641470b3046aeec31f07757991b792d722e10079926f7a289fb",
  "name":
  {
    "default":"New Name"
  },
  "description":
  {
    "default":"New Description"
  }
}

# in case of success:
 
RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
  "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
  "_type":"content_asset",
  "id" : "account-banner",
  "name":
  {
    "default":"New Name"
  },
  "description":
  {
    "default":"New Description"
  },
  "online":
  {
    "default":false
  },
  "searchable":
  {
    "default":false
  },
  "site_map_change_frequency":
  {
    "default":"never"
  },
  "site_map_included":
  {
    "default":0
  },
  "site_map_priority":
  {
    "default":0.0
  }
  "c_body":"<p>This is a body.</p>"
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
  "_type" : "fault",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with ID 'account-banner' in library 'SiteGenesis' was found."
  }
}

Get assigned folders list.

Action to get all assigned folders of a content asset.

Url

GET https://hostname:port/dw/data/v19_10/libraries/{library_id}/content/{content_id}/folders?start={Integer}&count={Integer}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Response Document

ContentFolderResult

Path Parameters

Parameter Type Description Constraints
content_id String The content id of the assignment. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

Query Parameters

Parameter Type Description Constraints
count Integer The maximum number of instances per request. Default value is 25. maxIntegerValue=200, minIntegerValue=1
start Integer The result set index to return the first instance for. Default value is 0. minIntegerValue=0

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 ContentNotFoundException

libraryId (String)

contentId (String)

Indicates that the content asset with the given id is unknown.

Sample

REQUEST:
GET /s/-/dw/data/v19_10/libraries/SiteGenesis/content/account-banner/folders?start=1&count=1 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8

# in case of success:

RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
   "_v" : "19.10",
   "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
  "_type":"content_folder_result",
   "count" : 1,
   "hits" : [
      {
         "id" : "about-us",
         "link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us",
         "parent_link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/root",
         "sub_folders_link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us/sub_folders"
      }
   ],
   "next" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/content/account-banner/folders?count=1&start=2",
   "previous" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/content/account-banner/folders?count=1&start=0",
   "start" : 1,
   "total" : 3
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type" : "fault",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with ID 'account-banner' in library 'SiteGenesis' was found."
  }
}

Get content folder assignment

Action to get a single content to folder assignment

Url

GET https://hostname:port/dw/data/v19_10/libraries/{library_id}/folder_assignments/{content_id}/{folder_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Response Document

ContentFolderAssignment

Path Parameters

Parameter Type Description Constraints
content_id String the ID of the content asset to retrieve. mandatory=true, maxLength=256, minLength=1, nullable=false
folder_id String ID of a target folder. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 ParentFolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the parent folder with the given id is unknown.
404 ContentNotFoundException

libraryId (String)

contentId (String)

Indicates that the content asset with the given id is unknown.
404 AssignmentNotFoundException

libraryId (String)

contentId (String)

folderId (String)

Indicates that no assignment between the given content asset and folder exists

Sample

REQUEST:
GET /s/-/dw/data/v19_10/libraries/SiteGenesis/folder_assignments/account-banner/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8

# in case of success:
 
RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
   "_v" : "19.10",
   "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
   "_type" : "content_folder_assignment",
   "content_id" : "account-banner",
   "content_link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/content/account-banner",
   "folder_id" : "about-us",
   "folder_link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us"
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type" : "fault",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with ID 'account-banner' in library 'SiteGenesis' was found."
  }
}

Assign content asset to folder.

Action to assign a content asset to a specified folder.

Url

PUT https://hostname:port/dw/data/v19_10/libraries/{library_id}/folder_assignments/{content_id}/{folder_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

ContentFolderAssignment

Response Document

ContentFolderAssignment

Path Parameters

Parameter Type Description Constraints
content_id String the content id mandatory=true, maxLength=256, minLength=1, nullable=false
folder_id String the folder id mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String the ID of the shared library or the site-id in case of a private library mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 ParentFolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the parent folder with the given id is unknown.
404 ContentNotFoundException

libraryId (String)

contentId (String)

Indicates that the content asset with the given id is unknown.

Sample

REQUEST:
PUT /s/-/dw/data/v19_10/libraries/SiteGenesis/folder_assignments/account-banner/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8
{
   "default":true
}

# in case of success:
 
RESPONSE:
HTTP/1.1 201 CREATED
Location: https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folder_assignments/account-banner/about-us
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
   "_v" : "19.10",
   "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
   "_type" : "content_folder_assignment",
   "content_id" : "account-banner",
   "content_link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/content/account-banner",
   "folder_id" : "my-account",
   "folder_link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/my-account"
   "default":true
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type":"fault",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with ID 'account-banner' in library 'SiteGenesis' was found."
  }
}

Unassign content asset from folder

Action to unassign a content asset from the specified library folder.

Url

DELETE https://hostname:port/dw/data/v19_10/libraries/{library_id}/folder_assignments/{content_id}/{folder_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Path Parameters

Parameter Type Description Constraints
content_id String the ID of the content asset to retrieve. mandatory=true, maxLength=256, minLength=1, nullable=false
folder_id String ID of a target folder. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 ParentFolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the parent folder with the given id is unknown.
404 ContentNotFoundException

libraryId (String)

contentId (String)

Indicates that the content asset with the given id is unknown.
404 AssignmentNotFoundException

libraryId (String)

contentId (String)

folderId (String)

Indicates that no assignment between the given content asset and folder exists

Sample

REQUEST:
DELETE /s/-/dw/data/v19_10/libraries/SiteGenesis/folder_assignments/account-banner/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8
x-dw-resource-state: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5

# in case of success:
 
RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type" : "fault",
  "fault":
  {
    "type":"AssignmentNotFoundException",
    "message":"No assignment from content asset with ID 'account-banner' to content folder with ID 'about-us' in library 'SiteGenesis' was found."
  }
}

Update content folder assignment

Action to update a single content to folder assignment. Currently only the position and default attribute can be changed.

Url

PATCH https://hostname:port/dw/data/v19_10/libraries/{library_id}/folder_assignments/{content_id}/{folder_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

ContentFolderAssignment

Response Document

ContentFolderAssignment

Path Parameters

Parameter Type Description Constraints
content_id String the content id of the assignment mandatory=true, maxLength=256, minLength=1, nullable=false
folder_id String ID of a target folder. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 FolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the folder with the given id is unknown.
404 ContentNotFoundException

libraryId (String)

contentId (String)

Indicates that the content asset with the given id is unknown.
404 AssignmentNotFoundException

libraryId (String)

contentId (String)

folderId (String)

Indicates that no assignment between the given content asset and folder exists.

Sample

REQUEST:
PATCH /s/-/dw/data/v19_10/libraries/SiteGenesis/folder_assignments/account-banner/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367

Content-Type: application/json; charset=UTF-8
{
   "_resource_state" : "847f9c3c5867f641470b3046aeec31f07757991b792d722e10079926f7a289fb",
   "position":1.0
}

# in case of success:
 
RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT

{
   "_v" : "19.10",
   "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
   "_type" : "content_folder_assignment",
   "content_id" : "account-banner",
   "content_link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/content/account-banner",
   "folder_id" : "my-account",
   "folder_link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/my-account"
   "default":false
   "position" : 1.0
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type":"fault",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with ID 'account-banner' in library 'SiteGenesis' was found."
  }
}

Get folder.

Action to get folder information.

Url

GET https://hostname:port/dw/data/v19_10/libraries/{library_id}/folders/{folder_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Response Document

ContentFolder

Path Parameters

Parameter Type Description Constraints
folder_id String ID of a target folder. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 FolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the folder with the given id is unknown.

Sample

REQUEST:
GET /s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8

# in case of success:

RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
  "_v":"19.10",
  "_resource_state" : "847f9c3c5867f641470b3046aeec31f07757991b792d722e10079926f7a289fb",
   "_type" : "content_folder",
  "id" : "about-us",
  "page_description" : 
  {
    "default" : "Page Descr. (Default)", 
    "en" : "Page Descr. (en)", 
    "en-US" : "Page Descr. (en_us)" 
  }, 
  "page_keywords" : 
  { 
    "default" : "Page Keywords (Default)", 
    "en" : "Page Keywords (en)", 
    "en-US" : "Page Keywords (en_us)" 
  }, 
  "parent_folder_id" : "root",
  "online" : false
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type" : "fault",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with ID 'about-us' in library 'SiteGenesis' was found."
  }
}

Update folder.

Action to create a new library folder, or to replace an existing folder. This action completely overwrites existing folders. Please note: Sub folders and assignments to content assets are not touched. This action ignores the folder ID in the input document.

Url

PUT https://hostname:port/dw/data/v19_10/libraries/{library_id}/folders/{folder_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

ContentFolder

Response Document

ContentFolder

Path Parameters

Parameter Type Description Constraints
folder_id String ID of a target folder. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 IdConflictException

bodyID (String)

urlID (String)

Indicates that the ID from the request body doesn't match the URL-Id.
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 ParentFolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the parent folder with the given id is unknown.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.data.content.folder.beforeCreate

beforeCreate (library : Library , create : ContentFolder ) : Status

The function is called before the content folder is created with the given document.

Parameters:
library - the library in the actual context
folder - the content folder create document.
Returns:
a non-null Status ends the hook execution
dw.ocapi.data.content.folder.afterCreate

afterCreate (library : Library , folder : Folder , create : ContentFolder ) : Status

The function is called after the new content folder was created.

Parameters:
library - the library in the actual context
folder - the new content folder.
create - the content folder create document.
Returns:
a non-null Status ends the hook execution

Sample

REQUEST:
PUT /s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8
{ 
  "page_description" : 
  {
    "default" : "Page Descr. (Default)", 
    "en" : "Page Descr. (en)", 
    "en-US" : "Page Descr. (en_us)" 
  }, 
  "page_keywords" : 
  { 
    "default" : "Page Keywords (Default)", 
    "en" : "Page Keywords (en)", 
    "en-US" : "Page Keywords (en_us)" 
  }, 
  "parent_folder_id" : "root",
  "online" : false
}

# in case of success:
 
RESPONSE:
HTTP/1.1 201 CREATED
Location: https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
  "_v":"19.10",
  "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
  "_type" : "content_folder",
  "id" : "about-us",
  "page_description" : 
  {
    "default" : "Page Descr. (Default)", 
    "en" : "Page Descr. (en)", 
    "en-US" : "Page Descr. (en_us)" 
  }, 
  "page_keywords" : 
  { 
    "default" : "Page Keywords (Default)", 
    "en" : "Page Keywords (en)", 
    "en-US" : "Page Keywords (en_us)" 
  }, 
  "parent_folder_id" : "root",
  "online" : false
}
 
# in case of library not found:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type":"fault",
  "fault":
  {
    "type":"LibraryNotFoundException",
    "message":"No library with ID 'SiteGenesis' was found."
  }
}

Delete a folder.

Delete folder

Url

DELETE https://hostname:port/dw/data/v19_10/libraries/{library_id}/folders/{folder_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Path Parameters

Parameter Type Description Constraints
folder_id String ID of a target folder. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.data.content.folder.beforeDelete

beforeDelete (library : Library , folder : Folder ) : Status

The function is called before the content folder is deleted.

Parameters:
library - the library in the actual context
folder - the content folder to be deleted.
Returns:
a non-null Status ends the hook execution
dw.ocapi.data.content.folder.afterDelete

afterDelete (library : Library ) : Status

The function is called after the content folder was deleted.

Parameters:
library - the library in the actual context
Returns:
a non-null Status ends the hook execution

Sample

REQUEST:
DELETE /s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8
x-dw-resource-state: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5

# in case of success:
 
RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type" : "fault",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with ID 'about-us' in library 'SiteGenesis' was found."
  }
}

Update folder.

Updates an existing folder. In the request, the If-Match header is required. The value of the header is an 'ETag' representing the last known base-point information for the library folder. If the header is missing, the server returns a 409 (IfMatchRequiredException) fault. If the header value does not match the server's 'ETag', the server returns a 412 (InvalidIfMatchException) fault. The delta information for the library folder is updated atomically: the information is written completely or not at all.

Url

PATCH https://hostname:port/dw/data/v19_10/libraries/{library_id}/folders/{folder_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

ContentFolder

Response Document

ContentFolder

Path Parameters

Parameter Type Description Constraints
folder_id String ID of a target folder. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 ContentFolderIdAlreadyInUseException

folderId (String)

Indicates that a content folder with the ID to change to is already existing.
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 FolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the folder with the given id is unknown.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.data.content.folder.beforeUpdate

beforeUpdate (library : Library , folder : Folder , update : ContentFolder ) : Status

The function is called before the content folder is updated with update document.

Parameters:
library - the library in the actual context
folder - the content folder to update.
update - the update document.
Returns:
a non-null Status ends the hook execution
dw.ocapi.data.content.folder.afterUpdate

afterUpdate (library : Library , folder : Folder , update : ContentFolder ) : Status

The function is called after the content folder is updated with update document.

Parameters:
library - the library in the actual context
folder - the content folder to update.
update - the update document.
Returns:
a non-null Status ends the hook execution

Sample

REQUEST:
PATCH /s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
{
  "_resource_state" : "847f9c3c5867f641470b3046aeec31f07757991b792d722e10079926f7a289fb",
  "page_description" :
  {
    "default":"New Default Description"
  }
}

# in case of success:
 
RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
  "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
  "_type" : "content_folder",
  "id" : "about-us",
  "page_description" : 
  {
    "default" : "New Default Description", 
    "en" : "Page Descr. (en)", 
    "en-US" : "Page Descr. (en_us)" 
  }, 
  "page_keywords" : 
  { 
    "default" : "Page Keywords (Default)", 
    "en" : "Page Keywords (en)", 
    "en-US" : "Page Keywords (en_us)" 
  }, 
  "parent_folder_id" : "root",
  "online" : false
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type" : "fault",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with ID 'about-us' in library 'SiteGenesis' was found."
  }
}

Get assigned content assets list

Action to get all assigned content assets of a folder.

Url

GET https://hostname:port/dw/data/v19_10/libraries/{library_id}/folders/{folder_id}/content?start={Integer}&count={Integer}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Response Document

ContentAssetResult

Path Parameters

Parameter Type Description Constraints
folder_id String ID of a target folder. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

Query Parameters

Parameter Type Description Constraints
count Integer The maximum number of instances per request. Default value is 25. maxIntegerValue=200, minIntegerValue=1
start Integer The result set index to return the first instance for. Default value is 0. minIntegerValue=0

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 FolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the folder with the given id is unknown.

Sample

REQUEST:
GET /s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us/content?start=1&count=1 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8

# in case of success:

RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
   "_v" : "19.10",
   "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
   "_type" : "content_asset_result",
   "count" : 1,
   "hits" : [
      {
         "id" : "about-us",
         "link" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/content/about-us"
      }
   ],
   "next" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us/content?count=1&start=2",
   "previous" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us/content?count=1&start=0",
   "start" : 1,
   "total" : 3
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type" : "fault",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with ID 'about-us' in library 'SiteGenesis' was found."
  }
}

Get sub folders.

Action to get sub folders information.

Url

GET https://hostname:port/dw/data/v19_10/libraries/{library_id}/folders/{folder_id}/sub_folders?start={Integer}&count={Integer}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Response Document

ContentSubFolderResult

Path Parameters

Parameter Type Description Constraints
folder_id String ID of a target folder. mandatory=true, maxLength=256, minLength=1, nullable=false
library_id String ID of the shared library or the site-id in case of a private library. mandatory=true, maxLength=256, minLength=1, nullable=false

Query Parameters

Parameter Type Description Constraints
count Integer The maximum number of instances per request. Default value is 25. maxIntegerValue=200, minIntegerValue=1
start Integer The result set index to return the first instance for. Default value is 0. minIntegerValue=0

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 LibraryNotFoundException

libraryId (String)

Indicates that library with the given id is unknown.
404 FolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the folder with the given id is unknown.

Sample

REQUEST:
GET /s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us/sub_folders?start=3&count=3 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8

# in case of success:

RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
{
   "_v" : "19.10",
   "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
   "_type" : "content_folder_result",
   "count" : 3,
   "hits" : [
      {
         "id" : "SubFolder1"
      },
      {
         "id" : "SubFolder2"
      },
      {
         "id" : "SubFolder3"
      }
   ],
   "next" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us/sub_folders?count=3&start=6",
   "previous" : "https://example.com/s/-/dw/data/v19_10/libraries/SiteGenesis/folders/about-us/sub_folders?count=3&start=0",
   "start" : 3,
   "total" : 9
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.10",
   "_type" : "fault",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with ID 'about-us' in library 'SiteGenesis' was found."
  }
}