(Quick Reference)
Service: Upsert a discount list
Description: This web service is used to insert a discount list to the database if it does not already exist, or update it.
URL with external_id:
https://BASE_URL/api/VERSION/discountLists/reference/{id}
Method: POST
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
name | | String | yes | |
percentageDiscount | The percentage discount | Double | yes | |
billingCategory | A billing category is a root item category | String/Long | no | |
itemCategories | A list of item categories | JSON list | no | [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 201 Created
{
"id": 4,
"reference": "discount70",
"name": "70% discount",
"percentageDiscount": 70.0,
"billingCategory": null,
"itemCategories": [],
"organization": "entity1",
"dateCreated": "2016-06-30T12:23:56Z",
"lastUpdated": "2016-06-30T12:23:56Z"
}
Failure Output
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 positive)"
}
{
"error": "not_unique",
"error_description": "reference already used"
}
{
"error": "missing_param",
"error_description": "name parameter is missing"
}