(Quick Reference)
Service: Save a report
Description: This web service is used to add a new report object to the database
URL:
https://BASE_URL/api/VERSION/reports
Method: POST
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
title | the title of the new report | String | Yes | |
description | the description related to the the new report | String | Yes | |
latitude | | String | No | |
longitude | | String | No | |
checkInDate | | String | No | 2016-09-21T17:00:00Z |
customerId | The numerical ID of customer | Long/String | no | |
userId | The numerical ID of user. By default, it is set to the current connected user | Long/String | no | |
type | indicate the report type | String | No | |
imageFile | Image 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 |
type
can only be equal to "1" (Customer complaint) , "2" (Customer note) or "3" (Manager note)
Success Output
Success case: response.status=201
{
"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..."
}