Sample Event Subscription Layout

This command subscribes to the different events of checkout. As shown below, it is possible to register for more than one event hook at a time. The request body attributes are the same for every event subscription request. The attributes are described in the table below the sample.

Sample Request Body:

{
    command: 'registerCallback', 
    version: 1.0,
    method: 'POST',
      data:[
        {
            callBackCommand : 'Checkout',                       
            hookName: 'checkoutStarted'
        },
        {
            callBackCommand : 'Checkout',
            hookName: 'checkoutComplete'
        },
        {
            callBackCommand : 'Checkout', 
            hookName: 'checkoutSyncComplete'
        }                                
    ]
}

Sample Response Body:

{
    command: 'registerCallback',
      version: 1.0,
      method: 'POST',
      responseType: 'registered',
      hooks:
        //This is an array which shows which events the app     
        //has attempted to register to.     
        [
            {
                //When the event has been successfully //registered, the response is as shown 
                //below.
                event : 'Checkout',
                hookName: 'checkoutStarted',
                status: 200,
                message: 'Event registered successfully',
                error: null
                
                  },
                  {
                event : 'Checkout',
                        hookName: 'checkoutComplete',
                        status: 200,
                        message: 'Event registered successfully',
                        error: null
                  },
                  {
                //When the event registration is 
                //unsuccessful, the response is as
                //shown below.
                        event : 'Checkout',
                        hookName: 'checkoutSyncComplete',
                        status: 402,
                        message: null,
                error: 'Error occurred when registering call back events, please check your request format.'
                  }                                
        ]
}

Sample Triggered Callback Response Body:

{
    command: 'registerCallback',
      version: 1.0,
      method: 'POST',
      responseType: 'triggered',
      callbackCommand: 'customerAdded',
      hookName: 'customerAddedToCart',
      data: {
            email: '[email protected]'
      }
}

Attributes Description:

This table details the properties of each attribute in an event subscription request.

Attribute Name

Attribute Type

Description

Enum

Required (binary)

command

string

This is a high level command to talk to Oliver.

null

1

method

string

It determines the CRUD operations based upon the type of request.

null

1

version

string

It determines the iteration of the command.

null

1

data

Array[object]

It includes the event and the hook name of the event being called.

null

1

event

string

It indicates the event being called.

null

1

hookName

string

It indicates which hook is being triggered for the event being called.

null

1


Did this page help you?