(Quick Reference)
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..."
}