(Quick Reference) Service: Save

Description: This web service is used to add a new unit object into the database

URL:

https://BASE_URL/api/VERSION/units

Method: POST

Request content type: application/json

Parameters:

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

Success Output

Success case: response.status=201
{
    "id": 16,
    "name": "packet",
    "reference": "PA",
    "organization": "Lyon",
    "dateCreated": "2016-08-18T12:53:26Z",
    "lastUpdated": "2016-08-18T12:53:26Z"
}

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": "save_failed",
     "error_description": "Failed to save instance"
}

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