General Error Responses
Ozan avatar
Written by Ozan
Updated over a week ago

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:

JSON

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

Response Body:

JSON

{ 
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:

JSON

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

Response Body:

JSON

{ 
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:

JSON

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

Response Body:

JSON

{ 
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:

JSON

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

Response Body:

JSON

{ 
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:

JSON

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

Request Body:

JSON

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

FAILURE - Invalid event:

Request Body:

JSON

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

Response Body:

JSON

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

FAILURE - Invalid hookName:

Request Body:

JSON

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

Response Body:

JSON

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