(Quick Reference) Service: Update an item-unit

Description: Returns the updated item-unit 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/itemUnits/{id}

Parameters:

NameDescriptionTypeRequiredExample values
idThe numerical ID of the desired item-unitIntegeryes123
itemIdThe numerical ID of itemLongyes 
unitIdThe numerical ID of unitLongyes 
quantityQuantity of product by unitIntegeryes 
salesQuantityQuantity used in sales operationsIntegerno 
volumeVolume of product by unit (m^3)Doubleno13.11
weightWeight of product by unit (kg)Doubleno16
barcode Stringno 
expirationDateThe expiration date field is automatically filled if the bar code meets the standard EAN 128Dateno2016-08-31
isDefaultThis parameter is required when item don't have a default unit,otherwise it is set to false by default.Booleanyestrue, false
defaultDisplay Booleannotrue, false
unpackingthis parameter is set to false by default.Booleannotrue, false

URL with external_id:

https://BASE_URL/api/VERSION/itemUnits/reference/{itemId}/{unitId}

Parameters:

NameDescriptionTypeRequiredExamples values
itemIdreference of the itemStringYeseliteBook_820
unitIdreference of the unitStringYesPiéce
quantityQuantity of product by unitIntegeryes 
salesQuantityQuantity used in sales operationsIntegerno 
volumeVolume of product by unit (m^3)Doubleno13.11
weightWeight of product by unit (kg)Doubleno16
barcode Stringno 
expirationDateThe expiration date field is automatically filled if the bar code meets the standard EAN 128Dateno2016-08-31
isDefaultThis parameter is required when item don't have a default unit,otherwise it is set to false by default.Booleanyestrue, false
defaultDisplay Booleannotrue, false

Every item must have only one default unit.

Success Output

Success case: response.status = 200

{
  "id": 92,
  "itemReference": "bracelet-GRP09062",
  "unitReference": "PACKET",
  "item": {
    "id": 497,
    "reference": "bracelet-GRP09062",
    "name": "Knot Band Bracelet",
    "href": "/api/v1.0/items/497"
  },
  "unit": {
    "id": 7,
    "reference": "PACKET",
    "name": "packet",
    "href": "/api/v1.0/units/7"
  },
  "quantity": 4,
  "unpacking": true,
  "salesQuantity": 1,
  "volume": 13,
  "weight":100.14
  "barcode": null,
  "expirationDate": "2016-08-30",
  "isDefault": false,
  "defaultDisplay": false,
  "organization": "entity1",
  "dateCreated": "2016-08-24T09:17:24Z",
  "lastUpdated": "2016-08-24T09:35:11Z"
}

Failure Output

Failure case:response.status = 400

{
  "error": "already_assigned",
  "error_description": "Item is already assigned to unit."
}
{
  "error": "date_validation_error",
  "error_description": "incorrect expiration date Format"
}
{
  "error": "is_default_error",
  "error_description": "Item should have a default unit."
}
{
  "error": "invalid_param_type",
  "error_description": "An invalid value was specified for parameter: weight (must be Positive Double)"
}
{
  "error": "refused_value",
  "error_description": "Sales quantity should be equal to 1."
}
{
  "error": "json_parsing_error",
  "error_description": "A JSON parsing error occurred while parsing request parameters."
}

Failure case:response.status = 404
{
  "error": "not_found",
  "error_description": "The item unit with the id 96 doesn't exist."
}
{
  "error": "not_found",
  "error_description": "The item with the id 123 doesn't exist."
}
{
  "error": "not_found",
  "error_description": "The unit with the id 70 doesn't exist."
}

Failure case:response.status = 500
{
    "error": "server_error",
    "error_description": "Oops! Something went wrong..."
}