clients

The following resources are applicable:

/clients

Mount Point: /rest/v2/clients

The following operations are supported on this resource:

GET

The clients REST service end point returns a set of clients

Parameters

name description type default
firstResult Optional, defaults to 0

Used for pagination, the firstResult query parameter specifies the first record to be returned by the 'List All Sales Invoices' end point. The parameter is 0 index-based, and so if requesting the first sales invoice in the list of sales invoices, firstResult should be set to 0.

The firstResult parameter is optional, and the default value for firstResult is 0. If specified, firstResult should be set to any non-negative integer.

query 0
resultsPerPage Optional, defaults to 0

Used for pagination, the resultsPerPage query parameter specifies the maximum number of results returned by the 'List All Sales Invoices' service.

The resultsPerPage parameter is relative to the firstResult parameter - therefore if firstResult is set to 0 and resultsPerPage is set to 10, then only the first 10 sales invoices from the overall list of sales invoices will be returned.

If firstResult is set to 10 and resultsPerPage is set to 10, then the service will return the next 10 records (i.e the sales invoices at positions 10 to 19 in the complete list of sales invoices).

The resultsPerPage parameter is optional. If no value is provided the service will return the entire result set - i.e. all sales invoices in the account. Valid values for resultsPerPage are any positive integer value, so any integer greater than or equal to 1.

query

Response Body

element: clients
media types: application/xml
application/json

Clients or Errors

Status Codes

HTTP Status Code Description
200 OK Clients found
400 Bad Request Invalid input, returns message body of Errors
500 Internal Server Error A database error has occurred

POST

The add client service allows a body of XML to be POSTed to the server. The service will validate the data contained within the XML payload and create a client within Crunch.

Request Body

element: client
media types: application/xml
application/json

A single client to add

Response Body

element: client
media types: application/xml
application/json

Client (with only the newly created clientId set) or Errors

Status Codes

HTTP Status Code Description
200 OK Client added
400 Bad Request Invalid input, returns message body of Errors
500 Internal Server Error A database error has occurred

OPTIONS

Options call to handle CORS requests (typically coming from javascript frameworks like jQuery) See here for further information.

Response Body

element: (custom)
media types: */*
application/xml

(no documentation provided)

/clients/{clientId}

Mount Point: /rest/v2/clients/{clientId}

The following operations are supported on this resource:

GET

The clients/{clientId} REST service end point returns a specific client based on the ID specified

Parameters

name description type default
clientId Id of client required path

Response Body

element: client
media types: application/xml
application/json

Client or Errors

Status Codes

HTTP Status Code Description
200 OK Client found
400 Bad Request Invalid input, returns message body of Errors
500 Internal Server Error A database error has occurred

PUT

The update client service allows a body of XML to be PUTted to the server. The service will validate the data contained within the XML payload and update a client within Crunch.

Parameters

name description type default
clientId The client id to update path

Request Body

element: client
media types: application/xml
text/xml
application/json

A single client to update

Response Body

element: client
media types: application/xml
application/json

Client (with only the updated clientId set) or Errors

Status Codes

HTTP Status Code Description
200 OK Client updated
400 Bad Request Invalid input, returns message body of Errors
500 Internal Server Error A database error has occurred

DELETE

The clients/{clientId} DELETE REST service end point deletes a specific client based on the ID specified

Parameters

name description type default
clientId The client id to delete path

Response Body

element: client
media types: application/xml
application/json

empty body or Errors

Status Codes

HTTP Status Code Description
204 No Content Client deleted
400 Bad Request Invalid input, returns message body of Errors
500 Internal Server Error A database error has occurred