General Error Responses

These are the general error responses which are to be sent back for all the events being implemented in Oliver.

FAILURE - Invalid command:

Request Body:

{
    command: 'Callforward',
      version: 1.0,
      method: 'POST',
      data:[
            {
                    event : 'Customer',
                    hookName: 'customerCreated'
              }
    ]
}

Response Body:

{
      command: 'Callforward',
      version: 1.0,
      method: 'POST',
      responseType: 'registered',
    Hooks: [
        {
                  event : 'Customer',
                    hookName: 'customerCreated',
                    status: 402,
                    message: null,
                    error: 'Invalid command'
                
              }
    ]
}

FAILURE - Invalid version:

Request Body:

{
    command: 'Callback',
      version: 'one',
      method: 'POST',
      data: [
            {
                    event : 'Customer',
                    hookName: 'customerCreated'
              }
    ]
}

Response Body:

{
    command: 'Callback',
      version: 'one',
      method: 'POST',
      responseType: 'registered',
      Hooks:[
        {
                event : 'Customer',
                    hookName: 'customerCreated',
                    status: 402,
                    message: null,
                    error: 'Invalid version'
            }
    ]
}

FAILURE - Invalid method:

Request Body:

{
    command: 'Callback',
    version: 1.0,
    method: 'POST',
    data: [
            {
                    event : 'Customer',
                    hookName: 'customerCreated'
              }
    ]
}

Response Body:

{
    command: 'Callback',
    version: 1.0,
      method: 'POST',
      responseType: 'registered',
      Hooks:[
        {
                    event : 'Customer',
                    hookName: 'customerCreated',
                    status: 402,
                    message: null,
                    error: 'Invalid method'
            }
    ]
}

FAILURE - Invalid data format:

The error shown here is the data field not being in an array

Request Body:

{
    command: 'Callback',
      version: 1.0,
      method: 'POST',
      data:   
            {
                    event : 'Customer',
                    hookName: 'customerCreated'
            }
}

Response Body:

{
    command: 'Callback',
      version: 1.0,
      method: 'POST',
      responseType: 'registered',
      Hooks:[
        {
                    event : 'Customer',
                    hookName: 'customerCreated',
                    status: 402,
                    message: null,
                    error: 'Invalid data format'
              }
    ]
}

FAILURE - Missing attribute:

This error is the same for every missing attribute. If there is one or more attributes missing, this error needs to be sent back. Please note that this also applies to data as well.

Request Body:

{
    command: 'Callback',
      version: 1.0,
      data:[
            {
                    event : 'Customer',
                    hookName: 'customerCreated'
              }
    ]
}

Request Body:

{
    command: 'Callback',
      version: 1.0,
    responseType: 'registered',
      Hooks:[
        {
                    event : 'Customer',
                    hookName: 'customerCreated',
                    status: 402,
                    message: null,
                    error: 'Missing attribute'
              }
    ]
}

FAILURE - Invalid event:

Request Body:

{
    command: 'Callback',
      version: 1.0,
      data:[
            {
                    event : 'Custom',
                    hookName: 'customerCreated'
              }
    ]
}

Response Body:

{
    command: 'Callback',
      version: 1.0,
    responseType: 'registered',
      Hooks:[
        {
            event : 'Custom',
            hookName: 'customerCreated',
            status: 402,
            message: null,
            error: 'Invalid event'
        }
    ]
}

FAILURE - Invalid hookName:

Request Body:

{
    command: 'Callback',
      version: 1.0,
      data:[
            {
                    event : 'Customer',
                    hookName: 'customerMade'
              }
    ]
}

Response Body:

{
    command: 'Callback',
      version: 1.0,
    responseType: 'registered',
      Hooks:[
        {
                    event : 'Customer',
                    hookName: 'customerMade',
                    status: 402,
                    message: null,
                    error: 'Invalid hook name'
        }
    ]
}

Did this page help you?