(Quick Reference) Service: Save

Description: This web service is used to update an existing unit object to the database

URL:

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

URL with external_id:

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

Method: PUT

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
referencethe new reference of the unitStringYes 
namethe new name of the unitStringYes 
reference must be unique

Success Output

Success case: response.status=201
{
    "id": 14,
    "name": "pieces",
    "reference": "PCS",
    "organization": "Lyon",
    "dateCreated": "2016-08-18T11:19:40Z",
    "lastUpdated": "2016-08-18T13:04:11Z"
}

Failure Output

Failure case:response.status = 400
{
    "error": "missing_param",
    "error_description": "reference parameter is missing"
}
{
    "error": "not_unique",
    "error_description": "reference already used"
}
{
    "error": "invalid_param_type",
    "error_description": "The type of parameter id you provided is not valid for this request."
}
{
     "error": "save_failed",
     "error_description": "Failed to save instance"
}

Failure case:response.status = 404
{
    "error": "not_found",
    "error_description": "The unit with the id 4444 doesn't exist."
}
Failure case:response.status = 500
{
    "error": "server_error",
    "error_description": "Oops! Something went wrong..."
}