(Quick Reference) Service: Update a price

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

Method: PUT

Request content type: application/json

URL:

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

Parameters:

NameDescriptionTypeRequiredExample values
idThe numerical ID of the desired priceLongyes123
itemIdThe numerical ID of itemLongyes 
unitIdThe numerical ID of unitLongyes 
priceListIdThe numerical ID of price-listLongyes 
valueThe price valueDoubleyes 
unitPriceThe unit price valueDoubleno 
marginRateMargin percentageDoubleno 

URL with external_id:

https://BASE_URL/api/VERSION/prices/reference/{itemId}/{unitId}/{priceListId}

Parameters:

NameDescriptionTypeRequiredExamples values
itemIdreference of the itemStringYeseliteBook_820
unitIdreference of the unitStringYesPiéce
priceListIdreference of the price listStringYesDL-001
valueThe price valueDoubleyes 
unitPriceThe unit price valueDoubleno 
marginRateMargin percentageDoubleno 

Success Output

Status: HTTP/1.1 200 OK

{
  "id": 1,
  "priceList": {
    "id": 1,
    "reference": "cost_based_pricing",
    "name": "Cost-based Pricing",
    "href": "/api/v1.0/priceLists/1"
  },
  "itemReference": "bracelet-GRP09062",
  "unitReference": "pcs",
  "itemUnit": {
    "id": 1,
    "href": "/api/v1.0/itemUnits/1"
  },
  "value": 22,
  "unitPrice": 20,
  "marginRate": 10,
  "organization": "entity1",
  "dateCreated": "2015-12-17T08:18:27Z",
  "lastUpdated": "2015-12-17T08:21:07Z"
}

Failure Output

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

Status: HTTP/1.1 400 Bad Request
{
  "error": "save_failed",
  "error_description": "Failed to save instance"
}
{
  "error": "not_unique",
  "error_description": "Price already used"
}
{
  "error": "invalid_param_type",
  "error_description": "An invalid value was specified for parameter: marginRate (must be positive)"
}