OCAPI Hooks for Data API

The following hooks exist in OCAPI version 23.1.

Content hooks for Data API.


dw.ocapi.data.content.content.afterCreate

PUT /libraries/{library_id}/content/{content_id}

Method details

afterCreate (library : dw.content.Library, content : dw.content.Content, create : ContentAsset) : dw.system.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

dw.ocapi.data.content.content.afterDelete

DELETE /libraries/{library_id}/content/{content_id}

Method details

afterDelete (library : dw.content.Library) : dw.system.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

dw.ocapi.data.content.content.afterUpdate

PATCH /libraries/{library_id}/content/{content_id}

Method details

afterUpdate (library : dw.content.Library, content : dw.content.Content, update : ContentAsset) : dw.system.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

dw.ocapi.data.content.content.beforeCreate

PUT /libraries/{library_id}/content/{content_id}

Method details

beforeCreate (library : dw.content.Library, create : ContentAsset) : dw.system.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.beforeDelete

DELETE /libraries/{library_id}/content/{content_id}

Method details

beforeDelete (library : dw.content.Library, content : dw.content.Content) : dw.system.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.beforeUpdate

PATCH /libraries/{library_id}/content/{content_id}

Method details

beforeUpdate (library : dw.content.Library, content : dw.content.Content, update : ContentAsset) : dw.system.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

Content folder hooks for Data API.


dw.ocapi.data.content.folder.afterCreate

PUT /libraries/{library_id}/folders/{folder_id}

Method details

afterCreate (library : dw.content.Library, folder : dw.content.Folder, create : ContentFolder) : dw.system.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

dw.ocapi.data.content.folder.afterDelete

DELETE /libraries/{library_id}/folders/{folder_id}

Method details

afterDelete (library : dw.content.Library) : dw.system.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

dw.ocapi.data.content.folder.afterUpdate

PATCH /libraries/{library_id}/folders/{folder_id}

Method details

afterUpdate (library : dw.content.Library, folder : dw.content.Folder, update : ContentFolder) : dw.system.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

dw.ocapi.data.content.folder.beforeCreate

PUT /libraries/{library_id}/folders/{folder_id}

Method details

beforeCreate (library : dw.content.Library, create : ContentFolder) : dw.system.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.beforeDelete

DELETE /libraries/{library_id}/folders/{folder_id}

Method details

beforeDelete (library : dw.content.Library, folder : dw.content.Folder) : dw.system.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.beforeUpdate

PATCH /libraries/{library_id}/folders/{folder_id}

Method details

beforeUpdate (library : dw.content.Library, folder : dw.content.Folder, update : ContentFolder) : dw.system.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

Customer hooks for Data API.


dw.ocapi.data.customer_list.customer.afterDELETE

DELETE /customer_lists/{list_id}/customers/{customer_no}

Method details

afterDelete (customerListId : String) : dw.system.Status

The function is called after the customer was deleted.

Parameters:
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customer.afterPATCH

PATCH /customer_lists/{list_id}/customers/{customer_no}

Method details

afterPatch (customer : dw.customer.Customer, update : Customer, customerListId : String) : dw.system.Status

The function is called after the customer is updated with update document.

Parameters:
customer - the customer to update.
update - the update document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customer.beforeDELETE

DELETE /customer_lists/{list_id}/customers/{customer_no}

Method details

beforeDelete (customer : dw.customer.Customer, customerListId : String) : dw.system.Status

The function is called before the customer is deleted.

Parameters:
customer - the customer to be deleted.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customer.beforePATCH

PATCH /customer_lists/{list_id}/customers/{customer_no}

Method details

beforePatch (customer : dw.customer.Customer, update : Customer, customerListId : String) : dw.system.Status

The function is called before the customer is updated with update document.

Parameters:
customer - the customer to update.
update - the update document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

Customers hooks for Data API.


dw.ocapi.data.customer_list.customers.afterPOST

POST /customer_lists/{list_id}/customers

Method details

afterPost (customer : dw.customer.Customer, create : Customer, customerListId : String) : dw.system.Status

The function is called after the new customer was created.

Parameters:
customer - the new customer.
create - the customer create document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customers.afterPUT

PUT /customer_lists/{list_id}/customers/{customer_no}

Method details

afterPut (customer : dw.customer.Customer, create : Customer, customerListId : String) : dw.system.Status

The function is called after the new customer was created.

Parameters:
customer - the new customer.
create - the customer create document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customers.beforePOST

POST /customer_lists/{list_id}/customers

Method details

beforePost (create : Customer, customerListId : String) : dw.system.Status

The function is called before the customer is created with the given document.

Parameters:
create - the customer create document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customers.beforePUT

PUT /customer_lists/{list_id}/customers/{customer_no}

Method details

beforePut (create : Customer, customerListId : String) : dw.system.Status

The function is called before the customer is created with the given document.

Parameters:
create - the customer create document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

Customer address hooks for Data API.


dw.ocapi.data.customer_list.customer.address.afterDELETE

DELETE /customer_lists/{list_id}/customers/{customer_no}/addresses/{address_id}

Method details

afterDelete (customer : dw.customer.Customer, customerListId : String) : dw.system.Status

The function is called after the customer address was deleted.

Parameters:
customer - the customer the address should be deleted for.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customer.address.afterPATCH

PATCH /customer_lists/{list_id}/customers/{customer_no}/addresses/{address_id}

Method details

afterPatch (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, update : CustomerAddress, customerListId : String) : dw.system.Status

The function is called after the customer address is updated with update document.

Parameters:
customer - the customer the address should be updated for.
update - the update document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customer.address.beforeDELETE

DELETE /customer_lists/{list_id}/customers/{customer_no}/addresses/{address_id}

Method details

beforeDelete (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, customerListId : String) : dw.system.Status

The function is called before the customer is deleted.

Parameters:
customer - the customer the address should be deleted for.
customerAddress - the customer address to be deleted.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customer.address.beforePATCH

PATCH /customer_lists/{list_id}/customers/{customer_no}/addresses/{address_id}

Method details

beforePatch (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, update : CustomerAddress, customerListId : String) : dw.system.Status

The function is called before the customer address is updated with update document.

Parameters:
customer - the customer the address should be updated for.
customerAddress - the customer address to update.
update - the update document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

Customer addresses hooks for Data API.


dw.ocapi.data.customer_list.customer.addresses.afterPOST

POST /customer_lists/{list_id}/customers/{customer_no}/addresses

Method details

afterPost (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, create : CustomerAddress, customerListId : String) : dw.system.Status

The function is called after the new customer address was created.

Parameters:
customer - the customer the address should be created for.
customerAddress - the new customer address.
create - the customer address create document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.customer_list.customer.addresses.beforePOST

POST /customer_lists/{list_id}/customers/{customer_no}/addresses

Method details

beforePost (customer : dw.customer.Customer, create : CustomerAddress, customerListId : String) : dw.system.Status

The function is called before a customer address is created with the given document.

Parameters:
customer - the customer the address should be created for.
create - the customer address create document.
customerListId - the id of the customerlist the customer is assigned to
Returns:
a non-null Status ends the hook execution

Object hooks for Data API.


dw.ocapi.data.object.afterDelete

DELETE /custom_objects/{object_type}/{key}

Method details

afterDelete () : dw.system.Status

The function is called after the custom object was deleted.

Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.afterDelete

DELETE /sites/{site_id}/custom_objects/{object_type}/{key}

Method details

afterDelete () : dw.system.Status

The function is called after the custom object was deleted.

Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.afterPatch

PATCH /custom_objects/{object_type}/{key}

Method details

afterPatch (customObject : dw.object.CustomObject, create : CustomObject) : dw.system.Status

The function is called after the custom object was updated with update document.

Parameters:
customObject - the updated custom object
update - the update document
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.afterPatch

PATCH /sites/{site_id}/custom_objects/{object_type}/{key}

Method details

afterPatch (customObject : dw.object.CustomObject, create : CustomObject) : dw.system.Status

The function is called after the custom object was updated with update document.

Parameters:
customObject - the updated custom object
update - the update document
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.afterPut

PUT /custom_objects/{object_type}/{key}

Method details

afterPut (customObject : dw.object.CustomObject, create : CustomObject) : dw.system.Status

The function is called after the custom object was created with create document.

Parameters:
customObject - the created custom object
create - the create document, may be null
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.afterPut

PUT /sites/{site_id}/custom_objects/{object_type}/{key}

Method details

afterPut (customObject : dw.object.CustomObject, create : CustomObject) : dw.system.Status

The function is called after the custom object was created with create document.

Parameters:
customObject - the created custom object
create - the create document, may be null
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.beforeDelete

DELETE /custom_objects/{object_type}/{key}

Method details

beforeDelete (customObject : dw.object.CustomObject) : dw.system.Status

The function is called before the custom object is removed.

Parameters:
create - the create document
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.beforeDelete

DELETE /sites/{site_id}/custom_objects/{object_type}/{key}

Method details

beforeDelete (customObject : dw.object.CustomObject) : dw.system.Status

The function is called before the custom object is removed.

Parameters:
create - the create document
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.beforePatch

PATCH /custom_objects/{object_type}/{key}

Method details

beforePatch (customObject : dw.object.CustomObject, update : CustomObject) : dw.system.Status

The function is called before the custom object is updated with update document.

Parameters:
update - the update document
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.beforePatch

PATCH /sites/{site_id}/custom_objects/{object_type}/{key}

Method details

beforePatch (customObject : dw.object.CustomObject, update : CustomObject) : dw.system.Status

The function is called before the custom object is updated with update document.

Parameters:
update - the update document
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.beforePut

PUT /custom_objects/{object_type}/{key}

Method details

beforePut (create : CustomObject) : dw.system.Status

The function is called before the custom object is created with create document.

Parameters:
create - the create document, may be null
Returns:
a non-null Status ends the hook execution

dw.ocapi.data.object.beforePut

PUT /sites/{site_id}/custom_objects/{object_type}/{key}

Method details

beforePut (create : CustomObject) : dw.system.Status

The function is called before the custom object is created with create document.

Parameters:
create - the create document, may be null
Returns:
a non-null Status ends the hook execution

Users hooks for Data API.


dw.ocapi.data.users.afterPATCH

PATCH /users/this/password

Method details

afterPatch (login : String, email : String) : dw.system.Status

The function is called after the user's password is updated.

Parameters:
login - The login of the user.
email - The email of the user.
Returns:
a non-null Status ends the hook execution