(Quick Reference)
10 Objectives - Reference Documentation
Version: 2.1
10 Objectives
10.1 List
Service: List objectives
Description: This web service return the list of objectives in JSON format.
URL:
https://BASE_URL/api/VERSION/objectives
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 or descending | 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 | |
type | Filters by the type of objective | Integer | no | 2,3,4 |
Dates should be formatted as the ISO-8601 format (YYYY-MM-DDTHH:MM:SSZ)
Success Output
Success case: response.status=200
{
"paging": {
"total": 4,
"max": 5,
"offset": 0,
"previous": null,
"next": null
},
"data": [
{
"id": 2,
"employeeReference": "emp-04",
"employee": {
"id": 4,
"reference": "emp-04",
"href": "/api/v1.0/users/4"
},
"itemReference": "bracelet-GRP09062",
"item": {
"id": 497,
"reference": "bracelet-GRP09062",
"name": "Knot Band Bracelet",
"href": "/api/v1.0/items/497"
},
"year": 2016,
"type": "4",
"januaryValue": 40,
"februaryValue": 40,
"marchValue": 40,
"aprilValue": 45,
"mayValue": 45,
"juneValue": 45,
"julyValue": 50,
"augustValue": 50,
"septemberValue": 50,
"octoberValue": 50,
"novemberValue": 50,
"decemberValue": 55,
"organization": "entity1",
"dateCreated": "2016-02-01T13:39:01Z",
"lastUpdated": "2016-02-01T13:39:01Z"
},…
]
}
Failure Output
Failure case:response.status = 400
{
"error": "invalid_param",
"error_description": "The parameters [dateCreated_gta] you provided are not valid for this request."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
10.2 Show
Service: Show an objective
Description: Returns the requested objective in json format when successful. Returns a json response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/objectives/{id}
Method: GET
Parameters:
Name | Description | Type | Required | Example values |
---|
id | The numerical ID of the desired objective | Long | Yes | 777 |
Success Output
Success case: response.status=200
{
"id": 2,
"employeeReference": "emp-04",
"employee": {
"id": 4,
"reference": "emp-04",
"href": "/api/v1.0/users/4"
},
"itemReference": "bracelet-GRP09062",
"item": {
"id": 497,
"reference": "bracelet-GRP09062",
"name": "Knot Band Bracelet",
"href": "/api/v1.0/items/497"
},
"year": 2016,
"type": "4",
"januaryValue": 40,
"februaryValue": 40,
"marchValue": 40,
"aprilValue": 45,
"mayValue": 45,
"juneValue": 45,
"julyValue": 50,
"augustValue": 50,
"septemberValue": 50,
"octoberValue": 50,
"novemberValue": 50,
"decemberValue": 55,
"organization": "entity1",
"dateCreated": "2016-02-01T13:39:01Z",
"lastUpdated": "2016-02-01T13:39:01Z"
}
Failure Output
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The objective with the id 1000 doesn't exist."
}
Failure case:response.status = 400
{
"error": "invalid_param_type",
"error_description": "The type of parameter id you provided is not valid for this request."
}
10.3 Create
Service: Create an objective
Description: Returns the created objective in json format when successful. Returns a json response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/objectives
Method: POST
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
type | Type can have only these values 2 if appointments number , 3 if turnover , 4 if item quantity | Integer | yes | 2,3,4 |
year | A year from 2000 to 2099 | Integer | yes | 2016 |
itemId | The ID of item. Required if objective type is equal to 4(item quantity ) | Long/String | - | |
userId | The ID of user | Long/String | yes | |
januaryValue | | Integer/Double | no | |
februaryValue | | Integer/Double | no | |
marchValue | | Integer/Double | no | |
aprilValue | | Integer/Double | no | |
mayValue | | Integer/Double | no | |
juneValue | | Integer/Double | no | |
julyValue | | Integer/Double | no | |
augustValue | | Integer/Double | no | |
septemberValue | | Integer/Double | no | |
octoberValue | | Integer/Double | no | |
novemberValue | | Integer/Double | no | |
decemberValue | | Integer/Double | no | |
useExternalId | By default, it is set to false. set it to true if you want to use external ids. | Boolean | no | true , false |
If objective type is equal to 4 (item quantity
) or 2 ( appointments number
) month value should be an integer
If objective type is equal to 3 (turnover
) month value should be a double
Success Output
Success case: response.status=201
An item must not be goody or asset
{
"id": 15,
"employeeReference": "emp-04",
"employee": {
"id": 4,
"reference": "emp-04",
"href": "/api/v1.0/users/4"
},
"itemReference": null,
"item": null,
"year": 2017,
"type": "3",
"januaryValue": 550.9,
"februaryValue": 500,
"marchValue": 100,
"aprilValue": 110,
"mayValue": 110,
"juneValue": 100,
"julyValue": 700,
"augustValue": 800,
"septemberValue": 1000,
"octoberValue": 600,
"novemberValue": 300,
"decemberValue": 300,
"organization": "entity1",
"dateCreated": "2016-08-25T13:31:14Z",
"lastUpdated": "2016-08-25T13:31:14Z"
}
Failure Output
Failure case:response.status = 400
{
"error": "already_existing",
"error_description": "Objective is already existing."
}
{
"error": "invalid_param_type",
"error_description": "An invalid value was specified for parameter: year (must be a year from 2000 to 2099)"
}
{
"error": "invalid_param_type",
"error_description": "An invalid value was specified for parameter: year (must be a year greater than or equal to 2017)"
}
{
"error": "missing_param",
"error_description": "userId parameter is missing"
}
{
"error": "missing_param",
"error_description": "itemId parameter is missing"
}
{
"error": "invalid_param",
"error_description": "Item must not be goody or asset"
}
{
"error": "invalid_param_type",
"error_description": "An invalid value was specified for parameter: januaryValue (must be positive)"
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The item with the id 4564 doesn't exist."
}
{
"error": "not_found",
"error_description": "The user with the id 4000 doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
10.4 Update
Service: Update an objective
Description: Returns the updated objective in json format when successful. Returns a json response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/objectives/{id}
Method: PUT
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
id | The numerical ID of the desired objective | Long | yes | 123 |
type | Type can have only these values 2 if appointments number , 3 if turnover , 4 if item quantity | Integer | yes | 2,3,4 |
year | A year from 2000 to 2099 | Integer | yes | 2016 |
itemId | The ID of item. Required if objective type is equal to 4(item quantity ) | Long/String | - | |
userId | The ID of user | Long/String | yes | |
januaryValue | | Integer/Double | no | |
februaryValue | | Integer/Double | no | |
marchValue | | Integer/Double | no | |
aprilValue | | Integer/Double | no | |
mayValue | | Integer/Double | no | |
juneValue | | Integer/Double | no | |
julyValue | | Integer/Double | no | |
augustValue | | Integer/Double | no | |
septemberValue | | Integer/Double | no | |
octoberValue | | Integer/Double | no | |
novemberValue | | Integer/Double | no | |
decemberValue | | Integer/Double | no | |
useExternalId | By default, it is set to false. set it to true if you want to use external ids. | Boolean | no | true , false |
Every item must have only one default unit
Success Output
Success case: response.status=200
{
"id": 15,
"employeeReference": "emp-04",
"employee": {
"id": 4,
"reference": "emp-04",
"href": "/api/v1.0/users/4"
},
"itemReference": null,
"item": null,
"year": 2017,
"type": "3",
"januaryValue": 550.9,
"februaryValue": 500,
"marchValue": 100,
"aprilValue": 110,
"mayValue": 110,
"juneValue": 100,
"julyValue": 700,
"augustValue": 800,
"septemberValue": 1000,
"octoberValue": 600,
"novemberValue": 300,
"decemberValue": 0,
"organization": "entity1",
"dateCreated": "2016-08-25T13:31:14Z",
"lastUpdated": "2016-08-25T13:47:20Z"
}
Failure Output
Failure case:response.status = 400
{
"error": "already_existing",
"error_description": "Objective is already existing."
}
{
"error": "invalid_param_type",
"error_description": "An invalid value was specified for parameter: year (must be a year from 2000 to 2099)"
}
{
"error": "missing_param",
"error_description": "userId parameter is missing"
}
{
"error": "missing_param",
"error_description": "itemId parameter is missing"
}
{
"error": "invalid_param_type",
"error_description": "An invalid value was specified for parameter: februaryValue (must be positive)"
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The objective with the id 96 doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
10.5 Delete
Service: Delete an objective
Description: Returns a json response.
URL:
https://BASE_URL/api/VERSION/objectives/{id}
Method: DELETE
Parameters:
Name | Description | Type | Required | Example values |
---|
id | The numerical ID of the desired objective | Long | yes | 123 |
Success Output
Success case: response.status=200
{
"success": "true",
"success_description": "Instance deleted successfully"
}
Failure Output
Failure case:response.status = 400
{
"error": "delete_failed",
"error_description": "Failed to delete instance."
}
Failure case:response.status = 404
{
"error": "not_found",
"error_description": "The objective with the id 70 doesn't exist."
}