(Quick Reference) 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:

NameDescriptionTypeRequiredExample values
idThe numerical ID of the desired objectiveLongyes123
typeType can have only these values 2 if appointments number, 3 if turnover, 4 if item quantityIntegeryes2,3,4
yearA year from 2000 to 2099Integeryes2016
itemIdThe ID of item. Required if objective type is equal to 4(item quantity)Long/String- 
userIdThe ID of userLong/Stringyes 
januaryValue Integer/Doubleno 
februaryValue Integer/Doubleno 
marchValue Integer/Doubleno 
aprilValue Integer/Doubleno 
mayValue Integer/Doubleno 
juneValue Integer/Doubleno 
julyValue Integer/Doubleno 
augustValue Integer/Doubleno 
septemberValue Integer/Doubleno 
octoberValue Integer/Doubleno 
novemberValue Integer/Doubleno 
decemberValue Integer/Doubleno 
useExternalIdBy default, it is set to false. set it to true if you want to use external ids.Booleannotrue , 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..."
}