POST, PUT and DELETE support for customer delivery locations

POST, PUT and DELETE support for customer delivery locations

We have now introduced the possibility to manage delivery locations through the REST API.
A delivery location is always linked to a customer, therefore an existing customer number must be provided with the request. If the customer number provided is not found, the response will contain a validation error.

Create new delivery location

POST /customers/:customerNumber/delivery-locations

When making a post request to create a delivery location, it is not mandatory to provide a location number. The next available number will be automatically assigned to the newly created delivery location.

{
        "address": "An address",
        "city": "A city",
        "country": "A country",
        "postalCode": "2000",
        "terms": "Some delivery terms",
        "barred": false,
        "externalId": "123"
}

The response will include, among the other properties, the location number and a self link which can subsequently be used to further modify the resource.

{
        ...
        "deliveryLocationNumber": 9,
        "self": "http://localhost/reviso-rest/customers/1/delivery-locations/9"
}

Update an existing delivery location

PUT /customers/:customerNumber/delivery-locations/:deliveryLocationNumber

All the properties, except the number, can be updated through a PUT request.

{
        "address": "Other address",
        "city": "Other city",
        "country": "Other country",
        "postalCode": "2001",
        "terms": "Other delivery terms",
        "barred": true,
        "externalId": "456"
}

Delete an existing delivery location

DELETE /customers/:customerNumber/delivery-locations/:deliveryLocationNumber

The DELETE command gives the possibility to permanently remove a delivery location. There are some restrictions to this. For example, the action fails with a validation error if the location is used as a customer default location. Additionally, if invoices have been issued with the given location, the response will contain an error message and the action will be aborted.

More information on customers is available here.
Hope you found the post helpful and for any request don’t hesitate to write us at api@reviso.com.

Leave a reply