(Quick Reference)

73 Reports - Reference Documentation

Version: 2.1

73 Reports

73.1 List

Service: List of reports

Description: This web service return the list of reports in JSON format

URL:

https://BASE_URL/api/VERSION/reports

Method: GET

Parameters:

Pagination parameters:

NameDescriptionTypeRequiredPossible values
offsetTells where to start returning records from the entire set of resultsIntegerNo 
maxlimits the number of resources requested to returnIntegerNo 
sortOrders the results by the specified fieldStringNo 
orderOrders ascending (ASC) or descending DESCIntegerNoasc, desc

Filters parameters:

NameDescriptionTypeRequiredExample values
dateCreated_gtFilters by the resource's creation date time and operator greater thanDateno2016-08-15T14:52:48Z
dateCreated_gteFilters by the resource's creation date time and operator greater than or equalDateno 
dateCreated_ltFilters by the resource's creation date time and operator less thanDateno 
dateCreated_lteFilters by the resource's creation date time and operator less than or equalDateno 
lastUpdated_gtFilters by the resource's last-modified date time and operator greater thanDateno 
lastUpdated_gteFilters by the resource's last-modified date time and operator greater than or equalDateno 
lastUpdated_ltFilters by the resource's last-modified date time and operator less thanDateno 
lastUpdated_lteFilters by the resource's last-modified date time and operator less than or equalDateno 
customerReferenceWildcard search by the resource's customer referenceStringnocustomerReference=Ref-6* , customerReference=*ef-6 , customerReference=*ef-6*
titleWildcard search by the resource's titleStringno 
employeeReferenceWildcard search by the resource's employee referenceStringnoemployeeReference=Ref-6* , employeeReference=*ef-6 , employeeReference=*ef-6*

Success Output

Success case: response.status=200

{
  "paging": {
    "total": 26,
    "max": 1,
    "offset": 0,
    "previous": null,
    "next": "/api/v1.0/reports?max=1&offset=1&sort=dateCreated&order=asc"
  },
  "data": [
    {
      "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": "invalid_param",
   "error_description": "The parameters [dateCreated_gta] you provided are not valid for this request."
}
{
    "error": "invalid_datetime_format",
    "error_description": "Invalid datetime filter (not ISO-8601 formatted): [2016-08-1Z]"
}

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

73.2 Show

Service: Show a report

Description: This web service return a report details of the specified id in JSON format

URL:

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

Method: GET

Parameters:

NameDescriptionTypeRequiredExample values
idid of the desired reportLongYes777

Success Output

Success case: response.status=200
{
  "id": 2,
  "title": "Marie's Jewelry complaint",
  "description": "Late Shipment",
  "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": "invalid_param_type",
    "error_description": "The type of parameter id you provided is not valid for this request."
}

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

73.3 Save

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/x-www-form-urlencoded or multipart/form-data

Parameters:

NameDescriptionTypeRequiredExample values
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=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..."
}

73.4 Delete

Service: Delete a report

Description: This web service is used in order to delete a report object from the database

URL:

https://BASE_URL/api/v1.0/reports/{id}

Method: DELETE

Parameters:

NameDescriptionTypeRequiredExamples values
idId of the desired report to deleteLongYes777

Success Output

Success case: response.status=200
{
    "success": "true",
    "success_description": "Instance deleted successfully"
}

Failure Output

Failure case:response.status = 400
{
    "error": "invalid_param_type",
    "error_description": "The type of parameter id you provided is not valid for this request."
}
Failure case:response.status = 404
{
    "error": "not_found",
    "error_description": "The report with the id 1 doesn't exist."
}

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

73.5 Update

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..."
}