(Quick Reference) Service: Save

Description: This web service is used to add a new customer category object to the database



Method: POST

Request content type: application/x-www-form-urlencoded or multipart/form-data


NameDescriptionTypeRequiredExample values
referencethe reference of the new customer categoryStringYes 
namethe name of the new customer categoryStringYes 
isRootdestined to declare if the new category is a root or notBooleanNo 
parentIdrepresent the Id of the parent customer categoryLong/StringYes if isRoot= false or isRoot=null 
imageimage specified to the new customer category it can be jpg, gif, png, bmpmultipartNo 
useExternalIdBy default, it is set to false. set it to true if you want to use external ids.Booleannotrue , false
reference must be unique
the default value of isRoot is set to false, parentId is required only if isRoot = false or isRoot = null

Success Output

Success case: response.status=201
    "id": 60,
    "name": "Preferred Customers",
    "isRoot": false,
    "parentId": 3,
    "parentCategory": {
        "id": 3,
        "reference": "101",
        "name": "new Categ",
        "href": "/api/v1.0/customerCategories/3"
    "reference": "102",
    "description": null,
    "image": null,
    "organization": "Lyon",
    "dateCreated": "2016-08-16T13:51:39Z",
    "lastUpdated": "2016-08-16T13:51:39Z"

To get resized images, add prefix small_ or medium_ to the link url before the image's name, for example:

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" : "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": "save_not_authorized",
  "error_description": "Organization should have only one root category of customer."
     "error": "save_failed",
     "error_description": "Failed to save instance"

Failure case:response.status = 404
     "error_description": "The parent customer category with the id 9999 doesn't exist."

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