(Quick Reference) Service: Upsert a tax

Description: This web service is used to insert a tax object to the database if it does not already exist, or update it.

URL with external_id:

https://BASE_URL/api/VERSION/taxes/reference/{taxListId}/{itemId}

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
itemIdThe ID of item. Required if tax type of list is not Fixed amountLong/String- 
taxListIdThe ID of tax-listLong/Stringyes 
taxValueThe tax valueDoubleyes 
useExternalIdBy default, it is set to false. set it to true if you want to use external ids.Booleannotrue , false

Success Output

Status: HTTP/1.1 201 Created

{
  "id": 1367,
  "itemReference": "bracelet-GRP09062",
  "item": {
    "id": 519,
    "reference": "bracelet-GRP09062",
    "name": "Knot Band Bracelet",
    "href": "/api/v1.0/items/519"
  },
  "taxListReference": "20_tax_list",
  "taxList": {
    "id": 7,
    "reference": "20_tax_list",
    "name": "VAT 20%",
    "href": "/api/v1.0/taxLists/7"
  },
  "taxValue": 24,
  "organization": "entity1",
  "dateCreated": "2016-02-10T13:36:18Z",
  "lastUpdated": "2016-02-10T13:36:18Z"
}

Failure Output

Status: HTTP/1.1 400 Bad Request

{
  "error": "save_failed",
  "error_description": "Failed to save instance"
}
{
  "error": "not_unique",
  "error_description": "tax already used"
}
{
  "error": "invalid_param_type",
  "error_description": "An invalid value was specified for parameter: taxValue (must be positive)"
}

Status: HTTP/1.1 404 Not Found
{
  "error": "not_found",
  "error_description": "The item with the id 4945 doesn't exist."
}
{
  "error": "not_found",
  "error_description": "The taxList with the id 457 doesn't exist."
}