(Quick Reference)
17 Categories of customers - Reference Documentation
Version: 2.1
17 Categories of customers
17.1 List
Service: List
Description: This web service return the list of customers categories in JSON format
URL:
https://BASE_URL/api/VERSION/customerCategories
Method: GET
Parameters:
Pagination parameters:
Name | Description | Type | Required | Possible values |
---|
offset | Tells where to start returning records from the entire set of results | Integer | No | |
max | limits the number of resources requested to return | Integer | No | |
sort | Orders the results by the specified field | String | No | |
order | Orders ascending (ASC) or descending DESC | Integer | No | asc, desc |
Filters parameters:
Name | Description | Type | Required | Example values |
---|
dateCreated_gt | Filters by the resource's creation date time and operator greater than | Date | no | 2016-08-15T14:52:48Z |
dateCreated_gte | Filters by the resource's creation date time and operator greater than or equal | Date | no | |
dateCreated_lt | Filters by the resource's creation date time and operator less than | Date | no | |
dateCreated_lte | Filters by the resource's creation date time and operator less than or equal | Date | no | |
lastUpdated_gt | Filters by the resource's last-modified date time and operator greater than | Date | no | |
lastUpdated_gte | Filters by the resource's last-modified date time and operator greater than or equal | Date | no | |
lastUpdated_lt | Filters by the resource's last-modified date time and operator less than | Date | no | |
lastUpdated_lte | Filters by the resource's last-modified date time and operator less than or equal | Date | no | |
reference | Wildcard search by the resource's reference | String | no | reference=Ref-6* , reference=*ef-6 , reference=*ef-6* |
name | Wildcard search by the resource's name | String | no | |
Success Output
Success case: response.status=200
{
"paging": {
"total": 7,
"max": 100,
"offset": 0,
"previous": null,
"next": null
},
"data": [
{
"id": 2,
"name": "Home",
"isRoot": true,
"parentId": null,
"parentCategory": null,
"reference": "Ref-01",
"description": "Home",
"image": "BASE_URL/Nice-1444810602520/photoCustomerCategory/1455207900621_users_crowd.png",
"organization": "Lyon",
"dateCreated": "2015-10-13T10:12:40Z",
"lastUpdated": "2016-02-11T16:25:00Z"
},
{
"id": 9,
"name": "TPE",
"isRoot": false,
"parentId": 2,
"parentCategory": {
"id": 2,
"reference": "Ref-01",
"name": "Home",
"href": "/api/v1.0/customerCategories/2"
},
"reference": "Ref-02",
"description": "Trés petites entreprises ",
"image": "BASE_URL/Nice-1444810602520/photoCustomerCategory/1455207886452_users_crowd.png",
"organization": "Lyon",
"dateCreated": "2015-10-30T10:19:40Z",
"lastUpdated": "2016-02-11T16:24:46Z"
},
{
"id": 10,
"name": "PME",
"isRoot": false,
"parentId": 2,
"parentCategory": {
"id": 2,
"reference": "Ref-01",
"name": "Home",
"href": "/api/v1.0/customerCategories/2"
},
"reference": "Ref-03",
"description": "Petites et moyennes entreprises",
"image": "BASE_URL/Nice-1444810602520/photoCustomerCategory/1455176799278_88c0f2f7d904fecacecaf4e585abcc45.png",
"organization": "Lyon",
"dateCreated": "2015-10-30T10:20:24Z",
"lastUpdated": "2016-02-11T07:46:40Z"
},
{
"id": 11,
"name": "TGE",
"isRoot": false,
"parentId": 2,
"parentCategory": {
"id": 2,
"reference": "Ref-01",
"name": "Home",
"href": "/api/v1.0/customerCategories/2"
},
"reference": "Ref-04",
"description": "Trés grande entreprise",
"image": "BASE_URL/Nice-1444810602520/photoCustomerCategory/1455207868614_users_crowd.png",
"organization": "Lyon",
"dateCreated": "2015-10-30T10:21:38Z",
"lastUpdated": "2016-02-11T16:24:29Z"
},…
]
}
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",
"error_description": "The parameters [dateCreated_gta] you provided are not valid for this request."
}
{
"error": "invalid_datetime_format",
"error_description": "Invalid datetime filter (not ISO-8601 formatted): [2016-08-1Z]"
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
17.2 Show
Service: Show
Description: This web service return a customer category details of the specified id in JSON format
URL:
https://BASE_URL/api/VERSION/customerCategories/{id}
URL with external_id:
https://BASE_URL/api/VERSION/customerCategories/reference/{id}
Method: GET
Parameters:
Name | Description | Type | Required | Example values |
---|
id | id of the wanted customer category | Long/String | Yes | 777 |
Success Output
Success case: response.status=200
{
"id": 2,
"name": "Home",
"isRoot": true,
"parentId": null,
"parentCategory": null,
"reference": "Ref-01",
"description": "Home",
"image": "BASE_URL/Nice-1444810602520/photoCustomerCategory/1455207900621_users_crowd.png",
"organization": "Lyon",
"dateCreated": "2015-10-13T10:12:40Z",
"lastUpdated": "2016-02-11T16:25:00Z"
}
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."
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The customer category with the id 999 doesn't exist."
}
17.3 Delete
Service: Delete
Description: This web service is used in order to delete a customer category object from the database
URL:
https://BASE_URL/api/VERSION/customerCategories/{id}
URL with external_id:
https://BASE_URL/api/VERSION/customerCategories/reference/{id}
Method: DELETE
Parameters:
Name | Description | Type | Required | Examples values |
---|
id | Id of the desired customer category to delete | Long/String | Yes | 777 |
Success Output
Success case: response.status=200
{
"success": "true",
"success_description": "Instance deleted successfully"
}
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": "delete_not_authorized",
"error_description": "Root category must not be deleted"
}
{
"error": "delete_failed",
"error_description": "Failed to delete 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..."
}
17.4 Update
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..."
}
17.5 Upsert
Service: Save
Description: This web service is used to insert an customer category object to the database if it does not already exist, or update it.
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 |
---|
name | the name of the new customer category | String | Yes | |
isRoot | destined to declare if the new category is a root or not | Boolean | No | |
parentId | represent the Id of the parent customer category | Long/String | Yes if isRoot= false or isRoot=null | |
image | image specified to the new customer category it can be jpg, gif, png, bmp | multipart | No | |
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:
<BASE_URL>/Nice-1444810602520/photoCustomerCategory/small_1455207868614_users_crowd.png
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":"not_found",
"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..."
}
17.6 Create
Service: Save
Description: This web service is used to add a new customer category object to the database
URL:
https://BASE_URL/api/VERSION/customerCategories
Method: POST
Request content type: application/x-www-form-urlencoded or multipart/form-data
Parameters:
Name | Description | Type | Required | Example values |
---|
reference | the reference of the new customer category | String | Yes | |
name | the name of the new customer category | String | Yes | |
isRoot | destined to declare if the new category is a root or not | Boolean | No | |
parentId | represent the Id of the parent customer category | Long/String | Yes if isRoot= false or isRoot=null | |
image | image specified to the new customer category it can be jpg, gif, png, bmp | multipart | No | |
useExternalId | By default, it is set to false. set it to true if you want to use external ids. | Boolean | no | true , 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:
<BASE_URL>/Nice-1444810602520/photoCustomerCategory/small_1455207868614_users_crowd.png
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":"not_found",
"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..."
}