suppliers

The following resources are applicable:

/suppliers

Mount Point: /rest/v2/suppliers

The following operations are supported on this resource:

GET

The suppliers REST service end point provides a list of all the suppliers in a Crunch customer's account.

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: suppliers
media types: application/xml
application/json

Suppliers or Errors

Status Codes

HTTP Status Code Description
200 OK Suppliers found
400 Bad Request Invalid input, returns message body of Errors

POST

The add supplier 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 supplier within Crunch.

Request Body

element: supplier
media types: application/xml
application/json
application/*+xml

A single supplier to add

Response Body

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

Suppliers (with only the newly created Supplier ID set) or Errors

Status Codes

HTTP Status Code Description
201 Created Suppliers added
400 Bad Request Invalid input, returns message body of Errors

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)

/suppliers/{supplierId}

Mount Point: /rest/v2/suppliers/{supplierId}

The following operations are supported on this resource:

GET

The suppliers REST service end point returns a specific supplier based on the ID specified

Parameters

name description type default
supplierId Id of supplier required path

Response Body

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

Supplier or Errors

Status Codes

HTTP Status Code Description
200 OK Supplier found
400 Bad Request Invalid input, returns message body of Errors

DELETE

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

Parameters

name description type default
supplierId The supplier id to update path

Response Body

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

empty body or Errors

Status Codes

HTTP Status Code Description
204 No Content Supplier deleted
400 Bad Request Invalid input, returns message body of Errors

PUT

The update supplier 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 supplier within Crunch.

Parameters

name description type default
supplierId The supplier id to update path

Request Body

element: supplier
media types: application/xml
application/json
application/*+xml

A single supplier to update

Response Body

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

Supplier (with only the updated supplierId set) or Errors

Status Codes

HTTP Status Code Description
201 Created Supplier updated
400 Bad Request Invalid input, returns message body of Errors