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 NameAttribute TypeDescriptionEnumRequired (binary)
commandstringThis is a high level command to talk to Oliver.null1
methodstringIt determines the CRUD operations based upon the type of request.null1
versionstringIt determines the iteration of the command.null1
dataArray[object]It includes the event and the hook name of the event being called.null1
eventstringIt indicates the event being called.null1
hookNamestringIt indicates which hook is being triggered for the event being called.null1