(Quick Reference) Service: Update a discount list

Description: Returns the updated discount list in json format when successful. Returns a json response, describing the failure condition when unsuccessful.

URL:

https://BASE_URL/api/VERSION/discountLists/{id}

URL with external_id:

https://BASE_URL/api/VERSION/discountLists/reference/{id}

Method: PUT

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
idThe ID of the desired discount listLong/Stringyes123
reference Stringyes 
name Stringyes 
percentageDiscountThe percentage discountDoubleyes 
billingCategoryA billing category is a root item categoryString/Longno 
itemCategoriesA list of item categoriesJSON listno[90,91]

A discount list should be assigned either to a billing category or to a list of item categories.
If you don't specify any of these parameter (billingCategory, itemCategories), discount list will be assigned to all categories.

Success Output

Status: HTTP/1.1 200 OK

{
  "id": 4,
  "reference": "discount70",
  "name": "70% discount",
  "percentageDiscount": 70.0,
  "organization": "entity1",
  "dateCreated": "2016-06-30T12:23:56Z",
  "lastUpdated": "2016-07-01T10:22:39Z"
}

Failure Output

Status: HTTP/1.1 404 Not Found
{
  "error": "not_found",
  "error_description": "The discount list with the id 404 doesn't exist."
}
{
    "error": "not_found",
    "error_description": "The item category with the id 1 doesn't exist."
}

Status: HTTP/1.1 400 Bad Request
{
  "error": "save_failed",
  "error_description": "Failed to save instance"
}
{
  "error": "invalid_param_type",
  "error_description": "An invalid value was specified for parameter: percentageDiscount (must be double)"
}

{
    "error": "invalid_param",
    "error_description": "The billing category should be a root item category"
}

{
    "error": "rule_validation_error",
    "error_description": "A discount list should be assigned either to a billing category or to a list of item categories."
}