Libraries Resource (Data API 15.1)

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).
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.
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 and deletes all existing folder assignments. 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.
GET /Libraries/{Library_id}/Content/{Content_id}/Folders Action to get all assigned folders of a content asset.
PUT /Libraries/{Library_id}/Folder_assignments/{Content_id}/{Folder_id} Action to assign a content asset to a specified folder.
GET /Libraries/{Library_id}/Folder_assignments/{Content_id}/{Folder_id} Action to get a single content to folder assignment
DELETE /Libraries/{Library_id}/Folder_assignments/{Content_id}/{Folder_id} Action to unassign a content asset from the specified library folder.
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, removing any assignments to sub folders or content assets. This action ignores the folder ID in the input document.
GET /Libraries/{Library_id}/Folders/{Folder_id} Action to get folder information.
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.
DELETE /Libraries/{Library_id}/Folders/{Folder_id} Delete a folder.
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/v15_1/libraries/{library_id}/content/{content_id}

Formats

json, xml

Response Document

ContentAsset

Path Parameters

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

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/v15_1/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
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
  "_v":"15.1",
  "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":"15.1",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with id 'account-banner' in library 'SiteGenesis' 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/v15_1/libraries/{library_id}/content/{content_id}

Formats

json, xml

Request Document

ContentAsset

Response Document

ContentAsset

Path Parameters

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

Header Parameters

Parameter Type Description Constraints
If-Match String the ETag header value contained in the server response  

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)

in case of content asset is already locked

Customization

This Resource supports server-side customization.

Extension Point Method Detail
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:
  • Status.OK for success.
  • Status.ERROR for error.
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:
  • Status.OK for success.
  • Status.ERROR for error.

Sample

REQUEST:
PATCH /s/-/dw/data/v15_1/libraries/SiteGenesis/content/account-banner HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
If-Match: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
  "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
ETag: t9ccde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73b8h6
{
  "_v":"15.1",
  "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":"15.1",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with id 'account-banner' in library 'SiteGenesis' 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 and deletes all existing folder assignments. 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/v15_1/libraries/{library_id}/content/{content_id}

Formats

json, xml

Request Document

ContentAsset

Response Document

ContentAsset

Path Parameters

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

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.
412 ResourceLockedException

componentName (String)

id (String)

in case of content asset is already existing and locked.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
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:
  • Status.OK for success.
  • Status.ERROR for error.
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:
  • Status.OK for success.
  • Status.ERROR for error.

Sample

REQUEST:
PUT /s/-/dw/data/v15_1/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 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
  "_v":"15.1",
  "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":"15.1",
  "fault":
  {
    "type":"LibraryNotFoundException",
    "message":"No library with id 'SiteGenesis' 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/v15_1/libraries/{library_id}/content/{content_id}

Formats

json, xml

Path Parameters

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

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)

in case of content asset is locked.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
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:
  • Status.OK for success.
  • Status.ERROR for error.
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:
  • Status.OK for success.
  • Status.ERROR for error.

Sample

REQUEST:
DELETE /s/-/dw/data/v15_1/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 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":"15.1",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with id 'account-banner' in library 'SiteGenesis' found."
  }
}

Get Assigned Folders List

Action to get all assigned folders of a content asset.

Url

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

Formats

json, xml

Response Document

ContentFolderResult

Path Parameters

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

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/v15_1/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
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
   "_v" : "15.1",
   "count" : 1,
   "hits" : [
      {
         "id" : "about-us",
         "link" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/folders/about-us",
         "parent_link" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/folders/root",
         "sub_folders_link" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/folders/about-us/sub_folders"
      }
   ],
   "next" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/content/account-banner/folders?count=1&start=2",
   "previous" : "https://example.com/s/-/dw/data/v15_1/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":"15.1",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with id 'account-banner' in library 'SiteGenesis' found."
  }
}

Assign Content Asset to Folder

Action to assign a content asset to a specified folder.

Url

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

Formats

json, xml

Response Document

ContentFolderAssignment

Path Parameters

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

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.
404 FolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the folder with the given id is unknown.

Sample

REQUEST:
PUT /s/-/dw/data/v15_1/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
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
   "_v" : "15.1",
   "content_id" : "account-banner",
   "content_link" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/content/account-banner",
   "folder_id" : "my-account",
   "folder_link" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/folders/my-account"
}

# 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":"15.1",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with id 'account-banner' in library 'SiteGenesis' found."
  }
}

Get Content Folder Assignment

Action to get a single content to folder assignment

Url

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

Formats

json, xml

Response Document

ContentFolderAssignment

Path Parameters

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

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.
404 FolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the folder 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/v15_1/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
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
   "_v" : "15.1",
   "content_id" : "account-banner",
   "content_link" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/content/account-banner",
   "folder_id" : "about-us",
   "folder_link" : "https://example.com/s/-/dw/data/v15_1/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":"15.1",
  "fault":
  {
    "type":"ContentNotFoundException",
    "message":"No content asset with id 'account-banner' in library 'SiteGenesis' found."
  }
}

Unassign Content Asset from Folder

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

Url

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

Formats

json, xml

Path Parameters

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

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.
404 FolderNotFoundException

libraryId (String)

folderId (String)

Indicates that the folder 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/v15_1/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 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":"15.1",
  "fault":
  {
    "type":"AssignmentNotFoundException",
    "message":"No assignment from content asset with id 'account-banner' to content folder with id 'about-us' in library 'SiteGenesis' found."
  }
}

Create or Replace a Folder

Action to create a new library folder, or to replace an existing folder. This action completely overwrites existing folders, removing any assignments to sub folders or content assets. This action ignores the folder ID in the input document.

Url

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

Formats

json, xml

Request Document

ContentFolder

Response Document

ContentFolder

Path Parameters

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

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.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:
  • Status.OK for success.
  • Status.ERROR for error.
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:
  • Status.OK for success.
  • Status.ERROR for error.

Sample

REQUEST:
PUT /s/-/dw/data/v15_1/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 200 OK
Expires: Thu, 01-Jan-1970 00:00:00 GMT
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
  "_v":"15.1",
  "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":"15.1",
  "fault":
  {
    "type":"LibraryNotFoundException",
    "message":"No library with id 'SiteGenesis' found."
  }
}

Get Folder

Action to get folder information.

Url

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

Formats

json, xml

Response Document

ContentFolder

Path Parameters

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

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/v15_1/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
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
  "_v":"15.1",
  "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":"15.1",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with id 'about-us' in library 'SiteGenesis' 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/v15_1/libraries/{library_id}/folders/{folder_id}

Formats

json, xml

Request Document

ContentFolder

Response Document

ContentFolder

Path Parameters

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

Header Parameters

Parameter Type Description Constraints
If-Match String the ETag header value contained in the server response  

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.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:
  • Status.OK for success.
  • Status.ERROR for error.
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:
  • Status.OK for success.
  • Status.ERROR for error.

Sample

REQUEST:
PATCH /s/-/dw/data/v15_1/libraries/SiteGenesis/folders/about-us HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
If-Match: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
  "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
ETag: t9ccde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73b8h6

  "_v":"15.1",
  "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":"15.1",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with id 'about-us' in library 'SiteGenesis' found."
  }
}

Delete Folder

Delete a folder.

Url

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

Formats

json, xml

Path Parameters

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

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.

Customization

This Resource supports server-side customization.

Extension Point Method Detail
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:
  • Status.OK for success.
  • Status.ERROR for error.
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:
  • Status.OK for success.
  • Status.ERROR for error.

Sample

REQUEST:
DELETE /s/-/dw/data/v15_1/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 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":"15.1",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with id 'about-us' in library 'SiteGenesis' found."
  }
}

Get Assigned Content Assets List

Action to get all assigned content assets of a folder.

Url

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

Formats

json, xml

Response Document

ContentAssetResult

Path Parameters

Parameter Type Description Constraints
folder_id String the folder id of the assignment maxLength=256, minLength=1
library_id String the ID of the shared library or the site-id in case of a private library maxLength=256, minLength=1

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/v15_1/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
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
   "_v" : "15.1",
   "count" : 1,
   "hits" : [
      {
         "id" : "about-us",
         "link" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/content/about-us"
      }
   ],
   "next" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/folders/about-us/content?count=1&start=2",
   "previous" : "https://example.com/s/-/dw/data/v15_1/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":"15.1",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with id 'about-us' in library 'SiteGenesis' found."
  }
}

Get Sub Folders

Action to get sub folders information.

Url

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

Formats

json, xml

Response Document

ContentSubFolderResult

Path Parameters

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

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/v15_1/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
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
   "_v" : "15.1",
   "count" : 3,
   "hits" : [
      {
         "id" : "SubFolder1"
      },
      {
         "id" : "SubFolder2"
      },
      {
         "id" : "SubFolder3"
      }
   ],
   "next" : "https://example.com/s/-/dw/data/v15_1/libraries/SiteGenesis/folders/about-us/sub_folders?count=3&start=6",
   "previous" : "https://example.com/s/-/dw/data/v15_1/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":"15.1",
  "fault":
  {
    "type":"FolderNotFoundException",
    "message":"No content folder with id 'about-us' in library 'SiteGenesis' found."
  }
}