(Quick Reference) Service: Save a report

Description: Returns the updated report in json format when successful. Returns a json response, describing the failure condition when unsuccessful.

URL:

https://BASE_URL/api/VERSION/reports/{id}

Method: POST

Request content type: application/x-www-form-urlencoded or multipart/form-data

Parameters:

NameDescriptionTypeRequiredExample values
idThe numerical ID of the desired reasonIntegeryes123
titlethe title of the new reportStringYes 
descriptionthe description related to the the new reportStringYes 
latitude StringNo 
longitude StringNo 
checkInDate StringNo2016-09-21T17:00:00Z
customerIdThe numerical ID of customerInteger/Stringno 
userIdThe numerical ID of user. By default, it is set to the current connected userLong/Stringno 
typeindicate the report typeStringNo 
imageFileImage can be in jpg, gif, png or bmp formatMultipartno 
useExternalIdBy default, it is set to false. set it to true if you want to use external ids.Booleannotrue , false
type can only be equal to "1" (Customer complaint) , "2" (Customer note) or "3" (Manager note)

Success Output

Success case: response.status=200
{
  "id": 2,
  "title": "Marie's Jewelry complaint ",
  "description": "Shipped Wrong Quantity",
  "image": "BASE_URL/entity1-1450169988465/photoNotes/1471338230737_logo_color_272x92dp.png",
  "latitude": 35.835454,
  "longitude": 10.590584,
  "checkInDate": "2015-12-31T15:48:32Z",
  "type": "1",
  "customerId": 2,
  "customer": {
    "id": 2,
    "reference": "NC-3",
    "name": "Marie's Jewelry",
    "href": "/api/v1.0/customers/2"
  },
  "user": {
    "id": 2,
    "reference": "emp-002",
    "href": "/api/v1.0/users/2"
  },
  "organization": "entity1",
  "dateCreated": "2015-12-31T15:48:32Z",
  "lastUpdated": "2015-12-31T15:48:32Z"
}

Failure Output

Failure case:response.status = 400
{
   "error": "missing_param",
   "error_description": "title parameter is missing"
}
{
   "error": "invalid_param_type",
   "error_description": "The type of parameter latitude you provided is not valid for this request."
}
{
   "error": "not_in_list_error",
   "error_description": "Failed to Save the Report , because type can have only these values [ 1,2,3 ]"
}
{
   "error":"invalid_datetime_format",
   "error_description": "Invalid datetime format for checkInDate it must be in this form : dd-MM-yyyy HH:mm"
}
{
   "error": "save_failed",
   "error_description": "Failed to save instance"
}

Failure case:response.status = 404
{
   "error": "not_found",
   "error_description": "The customer with the id 999 doesn't exist."
}

Failure case:response.status = 500
{
   "error": "server_error",
   "error_description": "Oops! Something went wrong..."
}