(Quick Reference)
8 Employees - Reference Documentation
Version: 2.1
8 Employees
8.1 List
Service: List of employees
Description: This web service returns the list of employees in JSON format.
URL:
https://BASE_URL/api/VERSION/employees
Method: GET
Parameters:
Pagination parameters:
Name | Description | Type | Required | Possible values |
---|
max | Limits the number of resources requested to return. | Integer | no | |
offset | Tells where to start returning records from the entire set of results. | Integer | no | |
order | Orders ascending or descending. | Integer | no | asc,desc |
sort | Orders the results by the specified field. | String | no | |
The max
parameter is set to 100
by default.
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* |
Dates should be formatted as the ISO-8601 format (YYYY-MM-DDTHH:MM:SSZ)
Success Output
Success case: response.status=200
{
"paging": {
"total": 20,
"max": 5,
"offset": 0,
"previous": null,
"next": "/api/v1.0/employees?max=5&sort=dateCreated&order=desc&offset=5"
},
"data": [
{
"id": 22,
"reference": "emp22",
"firstName": "Jane",
"lastName": "Doe",
"mobile": "001-555-555-1212",
"enabled": true,
"managerReference": "emp-00",
"employeeGroupReference": "60837-111",
"manager": {
"id": 3,
"reference": "emp-00",
"href": "/api/v1.0/employees/3"
},
"employeeGroup": {
"id": 1,
"reference": "60837-111",
"name": "Group1",
"href": "/api/v1.0/employeeGroups/1"
},
"avatar": null,
"organization": "entity1",
"dateCreated": "2016-08-17T13:45:17Z",
"lastUpdated": "2016-08-17T13:45:17Z"
},
…
]
}
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..."
}
8.2 Show
Service: Show an employee
Description: Returns the requested employee in json format when successful. Returns a json response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/employees/{id}
URL with external_id:
https://BASE_URL/api/VERSION/employees/reference/{id}
Method: GET
Parameters:
Name | Description | Type | Required | Example values |
---|
id | The ID of the desired employee | Long/String | yes | 12 |
Success Output
Success case: response.status=200
{
"id": 22,
"reference": "emp22",
"firstName": "Jane",
"lastName": "Doe",
"mobile": "001-555-555-1212",
"enabled": true,
"managerReference": "emp-00",
"employeeGroupReference": "60837-111",
"manager": {
"id": 3,
"reference": "emp-00",
"href": "/api/v1.0/employees/3"
},
"employeeGroup": {
"id": 1,
"reference": "60837-111",
"name": "Group1",
"href": "/api/v1.0/employeeGroups/1"
},
"avatar": null,
"organization": "entity1",
"dateCreated": "2016-08-17T13:45:17Z",
"lastUpdated": "2016-08-17T13:45:17Z"
}
To get resized images, add prefix small_
or medium_
to the link url before the image's name, for example:
<BASE_URL>/entity1-1450169988465/avatar/medium_1471442935596_1448038178_supportfemale.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 employee with the id 7065 doesn't exist."
}
8.3 Create
Service: Create an employee
Description: Returns the created employee in json format when successful. Returns a json response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/employees
Method: POST
Request content type: application/x-www-form-urlencoded or multipart/form-data
Parameters:
Name | Description | Type | Required | Example values |
---|
reference | | String | yes | |
firstName | | String | yes | |
lastName | | String | yes | |
employeeGroupId | The ID of the employee group. | Long/String | no | |
managerId | The ID of employee. | LOng/String | no | |
enabled | By default, it is set to true | Boolean | no | true, false |
mobile | | String | no | |
imageFile | Image of employee can be in jpg, gif, png or bmp format | 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 |
Success Output
Success case: response.status=201
{
"id": 22,
"reference": "emp_22",
"firstName": "Jane",
"lastName": "Doe",
"mobile": "001-555-555-1212",
"enabled": true,
"managerReference": "emp-00",
"employeeGroupReference": "60837-111",
"manager": {
"id": 3,
"reference": "emp-00",
"href": "/api/v1.0/employees/3"
},
"employeeGroup": {
"id": 1,
"reference": "60837-111",
"name": "Group1",
"href": "/api/v1.0/employeeGroups/1"
},
"avatar": "BASE_URL/entity1-1450169988465/avatar/1471442935596_1448038178_supportfemale.png",
"organization": "entity1",
"dateCreated": "2016-08-17T13:45:17Z",
"lastUpdated": "2016-08-17T14:08:55Z"
}
To get resized images, add prefix small_
or medium_
to the link url before the image's name, for example:
<BASE_URL>/entity1-1450169988465/avatar/medium_1471442935596_1448038178_supportfemale.png
Failure Output
Failure case:response.status = 400
{
"error": "save_failed",
"error_description": "Failed to save instance."
}
{
"error": "not_unique",
"error_description": "reference already used"
}
{
"error": "missing_param",
"error_description": "firstName parameter is missing"
}
{
"error": "unsupported_file_type",
"error_description": "image format not supported."
}
{
"error": "exceeded_file_size",
"error_description": "image size should not exceed 2Mo"
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The manager with the id 22 doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
8.4 Update
Service: Update an employee
Description: Returns the updated employee in json format when successful. Returns a json response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/employees/{id}
URL with external_id:
https://BASE_URL/api/VERSION/employees/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 employee to update | Long | Yes | 777 |
reference | | String | yes | |
firstName | | String | yes | |
lastName | | String | yes | |
employeeGroupId | The ID of the employee group. | Long/String | no | |
managerId | The ID of employee. | Long/String | no | |
enabled | By default, it is set to true | Boolean | no | true, false |
mobile | | String | no | |
imageFile | Image of employee can be in jpg, gif, png or bmp format | multipart | no | |
Success Output
Success case: response.status=200
{
"id": 22,
"reference": "emp22",
"firstName": "Jane",
"lastName": "Doe",
"mobile": "001-555-555-1212",
"enabled": true,
"managerReference": "emp-00",
"employeeGroupReference": "60837-111",
"manager": {
"id": 3,
"reference": "emp-00",
"href": "/api/v1.0/employees/3"
},
"employeeGroup": {
"id": 1,
"reference": "60837-111",
"name": "Group1",
"href": "/api/v1.0/employeeGroups/1"
},
"avatar": null,
"organization": "entity1",
"dateCreated": "2016-08-17T13:45:17Z",
"lastUpdated": "2016-08-17T13:45:17Z"
}
To get resized images, add prefix small_
or medium_
to the link url before the image's name, for example:
<BASE_URL>/entity1-1450169988465/avatar/medium_1471442935596_1448038178_supportfemale.png
Failure Output
Failure case:response.status = 400
{
"error": "save_failed",
"error_description": "Failed to save instance."
}
{
"error": "not_unique",
"error_description": "reference already used"
}
{
"error": "missing_param",
"error_description": "firstName parameter is missing"
}
{
"error": "unsupported_file_type",
"error_description": "image format not supported."
}
{
"error": "exceeded_file_size",
"error_description": "image size should not exceed 2Mo"
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The manager with the id 22 doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
8.5 Upsert
Service: Upsert an employee
Description: This web service is used to insert an employee object to the database if it does not already exist, or update it.
URL with external_id:
https://BASE_URL/api/VERSION/employees/reference/{id}
Method: POST
Request content type: application/x-www-form-urlencoded or multipart/form-data
Parameters:
Name | Description | Type | Required | Example values |
---|
reference | | String | yes | |
firstName | | String | yes | |
lastName | | String | yes | |
employeeGroupId | The ID of the employee group. | String | no | |
managerId | The ID of employee. | String | no | |
enabled | By default, it is set to true | Boolean | no | true, false |
mobile | | String | no | |
imageFile | Image of employee can be in jpg, gif, png or bmp format | multipart | no | |
Success Output
Success case: response.status=201
{
"id": 22,
"reference": "emp_22",
"firstName": "Jane",
"lastName": "Doe",
"mobile": "001-555-555-1212",
"enabled": true,
"managerReference": "emp-00",
"employeeGroupReference": "60837-111",
"manager": {
"id": 3,
"reference": "emp-00",
"href": "/api/v1.0/employees/3"
},
"employeeGroup": {
"id": 1,
"reference": "60837-111",
"name": "Group1",
"href": "/api/v1.0/employeeGroups/1"
},
"avatar": "BASE_URL/entity1-1450169988465/avatar/1471442935596_1448038178_supportfemale.png",
"organization": "entity1",
"dateCreated": "2016-08-17T13:45:17Z",
"lastUpdated": "2016-08-17T14:08:55Z"
}
To get resized images, add prefix small_
or medium_
to the link url before the image's name, for example:
<BASE_URL>/entity1-1450169988465/avatar/medium_1471442935596_1448038178_supportfemale.png
Failure Output
Failure case:response.status = 400
{
"error": "save_failed",
"error_description": "Failed to save instance."
}
{
"error": "not_unique",
"error_description": "reference already used"
}
{
"error": "missing_param",
"error_description": "firstName parameter is missing"
}
{
"error": "unsupported_file_type",
"error_description": "image format not supported."
}
{
"error": "exceeded_file_size",
"error_description": "image size should not exceed 2Mo"
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The manager with the id 22 doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}