(Quick Reference)
Service: Update
Description: This web service is used in order to update an existing customer category object into the database
URL:
https://BASE_URL/api/VERSION/customerCategories/{id}
URL with external_id:
https://BASE_URL/api/VERSION/customerCategories/reference/{id}
Method: POST
Request content type: application/x-www-form-urlencoded or multipart/form-data
Parameters:
Name | Description | Type | Required | example values |
---|
id | id of the desired customer category to update | Long/String | Yes | 777 |
reference | the new reference value | String | Yes | |
name | the new name value | String | Yes | |
description | the new description value | String | No | |
image | image specified to the new customer category it can be jpg, gif, png, bmp | multipart | No | |
reference must be unique
Success Output
Success case: response.status=200
{
"paging": {
"total": 1,
"max": 100,
"offset": 0,
"previous": null,
"next": null
},
"data": [
{
"id": 3,
"name": "new Categ",
"isRoot": false,
"parentId": 3,
"parentCategory": {
"id": 3,
"reference": "101",
"name": "new Categ",
"href": "/api/v1.0/customerCategories/3"
},
"reference": "101",
"description": "Home",
"image": null,
"organization": "Lyon",
"dateCreated": "2015-10-13T10:12:40Z",
"lastUpdated": "2016-08-16T13:19:11Z"
}
]
}
To get resized images, add prefix small_
or medium_
to the link url before the image's name, for example:
<BASE_URL>/Nice-1444810602520/photoCustomerCategory/small_1455207868614_users_crowd.png
Failure Output
Failure case:response.status = 400
{
"error": "invalid_param_type",
"error_description": "The type of parameter id you provided is not valid for this request."
}
{
"error": "missing_param",
"error_description": "reference parameter is missing"
}
{
"error": "not_unique",
"error_description": "reference already used"
}
{
"error" : "invalid_param_type",
"error_description" : "An invalid value was specified for parameter: isRoot (must be a boolean: true or false)"
}
{
"error": "exceeded_file_size",
"error_description": "image size should not exceed 2Mo"
}
{
"error": "unsupported_file_type",
"error_description": "image format not supported."
}
{
"error": "update_not_authorized",
"error_description": "Organization should have only one root category ofcustomer."
}
{
"error": "update_not_authorized",
"error_description": "Organization should have at least one and only root category of customer."
}
{
"error": "save_failed",
"error_description": "Failed to save instance"
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The customer category with the id 1 doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}