Reports

Reports scheme

Each report is identified by its unique id. A report is defined for a certain machine event identified by event_id which is defined for a certain machine. Each report is created by an operator_id operator after a solution has been tried, so a solution_id field is present in order to identify it, and a success field that indicates whether the solution has worked or not.

Additionally comment field is a non unique strings used for greater readability and additional information.

Scheme:

{
    "id": "UUID",
    "event_id": "UUID",
    "solution_id": "UUID",
    "operator_id": "String",
    "success": "Boolean",
    "comment": "String"
}

Example solution:

{
    "id": "c228b656-e2b6-42b0-ae51-40e977dabc75",
    "event_id": "07a6c0d7-e264-4576-9338-9eb4ce385490",
    "solution_id": "5880f2f1-e548-4db5-9ef3-3e23954689f4",
    "operator_id": "986c6f2e-7c49-4c0b-9bb3-9566ea3e9b02",
    "success": true,
    "comment": "Solution was perfect and easy for this defect"
}

GET methods

GET /api/reports

Returns all reports with their relative information if at least one resource exists, otherwise returns an empty collection. Request can contain a page parameter that returns a specific page, additionally total number of pages, next page, previous page and other information are described in the response header.

Optionally reports can be filtered by the event_id, solution_id or defect_id (even though defect_id is not present in the resource fields) if passed as a query parameter. Example requests are:

GET /api/reports?event_id=07a6c0d7-e264-4576-9338-9eb4ce385490 HTTP/1.1
GET /api/reports?solution_id=5880f2f1-e548-4db5-9ef3-3e23954689f4 HTTP/1.1
GET /api/reports?defect_id=0fc6d020-7f96-4424-9005-9e691d9c90e5 HTTP/1.1

Example request:

GET /api/reports HTTP/1.1
Host: |localhost|

Example response:

HTTP/1.1 200 OK
Content-type: application/json
X-Total: 2
X-Total-Pages: 1
X-Page: 1
X-Per-Page: 10

[
        {
            "id": "c228b656-e2b6-42b0-ae51-40e977dabc75",
            "event_id": "07a6c0d7-e264-4576-9338-9eb4ce385490",
            "solution_id": "5880f2f1-e548-4db5-9ef3-3e23954689f4",
            "operator_id": "986c6f2e-7c49-4c0b-9bb3-9566ea3e9b02",
            "success": true,
            "comment": "Solution was perfect and easy for this defect"
        }
]
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
  • page (integer) – page number, 10 resources per page are returned, default is 1
  • event_id (string) – id of the event used to filter the reports
  • solution_id (string) – id of the solution used to filter the reports
  • defect_id (string) – id of the defect used to filter the reports
Response Headers:
 
  • X-Total – total number of elements in the collection server-side
  • X-Total-Pages – total number of pages containing all elements
  • X-Page – current page that has been returned
  • X-Per-Page – number of elements per page
  • X-Next-Page – id of next page
  • X-Previous-Page – id of previous page
Response JSON Array of Objects:
 
  • id (string) – id of the report
  • event_id (string) – id of the event to which the report is refering
  • operator_id (string) – id of the operator to which the report is refering
  • solution_id (string) – id of the solution to which the report is refering
  • success (boolean) – success of applying the solution to the defect by operator
  • comment (string) – comment of the operator that created the report
Status Codes:
GET /api/reports/:id

Returns a specific report with :id and the rest of its parameters if it exists, otherwise returns 404 error.

Example request:

GET /api/reports/c228b656-e2b6-42b0-ae51-40e977dabc75 HTTP/1.1
Host: |localhost|

Example response:

HTTP/1.1 200 OK
Content-type: application/json

    {
        "id": "c228b656-e2b6-42b0-ae51-40e977dabc75",
        "event_id": "07a6c0d7-e264-4576-9338-9eb4ce385490",
        "solution_id": "5880f2f1-e548-4db5-9ef3-3e23954689f4",
        "operator_id": "986c6f2e-7c49-4c0b-9bb3-9566ea3e9b02",
        "success": true,
        "comment": "Solution was perfect and easy for this defect"
    }
Parameters:
  • id (string) – report’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Object:
 
  • id (string) – id of the report
  • event_id (string) – id of the event to which the report is refering
  • operator_id (string) – id of the operator to which the report is refering
  • solution_id (string) – id of the solution to which the report is refering
  • success (boolean) – success of applying the solution to the defect by operator
  • comment (string) – comment of the operator that created the report
Status Codes:

POST methods

POST /api/reports

Adds a new report with its event_id, operator_id, solution_id, success and comment. id is generated server-side. Returns an URI location of the new resource or error message.

Note: Do not execute twice the same POST request for it will create two resources with the same information.

Example request:

POST /api/reports HTTP/1.1
Host: |localhost|
Content-Type: application/json

    {
        "event_id": "07a6c0d7-e264-4576-9338-9eb4ce385490",
        "solution_id": "5880f2f1-e548-4db5-9ef3-3e23954689f4",
        "success": true,
        "comment": "Solution was perfect and easy for this defect"
    }

Example response:

HTTP/1.1 201 CREATED
Content-type: application/json

  {
      "id": "c228b656-e2b6-42b0-ae51-40e977dabc75",
      "event_id": "07a6c0d7-e264-4576-9338-9eb4ce385490",
      "solution_id": "5880f2f1-e548-4db5-9ef3-3e23954689f4",
      "operator_id": "986c6f2e-7c49-4c0b-9bb3-9566ea3e9b02",
      "success": true,
      "comment": "Solution was perfect and easy for this defect"
  }
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Object:
 
  • event_id (string) – event id on which a solution has been applied
  • solution_id (string) – solution id that was implemented
  • success (boolean) – outcome of the application of the solution
  • comment (string) – comment of the operator that proposed or applied the solution
Response JSON Object:
 
  • id (string) – id of the report
  • event_id (string) – id of the event to which the report is refering
  • operator_id (string) – id of the operator to which the report is refering
  • solution_id (string) – id of the solution to which the report is refering
  • success (boolean) – success of applying the solution to the defect by operator
  • comment (string) – comment of the operator that created the report
Status Codes:

PUT methods

PUT /api/reports/:id

Updates an existing report with new information. Returns an URI location of the new resource or error message.

Note: All parameters must be defined with the PUT request, ie. PUT request replaces the existing resource with the modified one if it exists, or creates a new one.

Example request:

PUT /api/reports/c228b656-e2b6-42b0-ae51-40e977dabc75 HTTP/1.1
Host: |localhost|
Content-Type: application/json

    {
        "event_id": "07a6c0d7-e264-4576-9338-9eb4ce385490",
        "solution_id": "5880f2f1-e548-4db5-9ef3-3e23954689f4",
        "operator_id": "986c6f2e-7c49-4c0b-9bb3-9566ea3e9b02",
        "success": true,
        "comment": "Solution was perfect and easy for this defect"
    }

Example response:

HTTP/1.1 200 OK
Content-type: application/json

    {
        "id": "c228b656-e2b6-42b0-ae51-40e977dabc75",
        "event_id": "07a6c0d7-e264-4576-9338-9eb4ce385490",
        "solution_id": "5880f2f1-e548-4db5-9ef3-3e23954689f4",
        "operator_id": "986c6f2e-7c49-4c0b-9bb3-9566ea3e9b02",
        "success": true,
        "comment": "Solution was perfect and easy for this defect"
    }
Parameters:
  • id (integer) – report’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Object:
 
  • event_id (string) – event id on which a solution has been applied
  • operator_id (string) – operator id that wrote the report and/or implemented the solution
  • solution_id (string) – solution id that was implemented
  • success (boolean) – outcome of the application of the solution
  • comment (string) – comment of the operator that proposed or applied the solution
Response JSON Object:
 
  • id (string) – id of the report
  • event_id (string) – id of the event to which the report is refering
  • operator_id (string) – id of the operator to which the report is refering
  • solution_id (string) – id of the solution to which the report is refering
  • success (boolean) – success of applying the solution to the defect by operator
  • comment (string) – comment of the operator that created the report
Status Codes:

DELETE methods

DELETE /api/reports/:id

Delete an existing report, responds with the confirmation or error. Can only delete one resource at a time, to remove a collection of reports call the DELETE method for each element.

Example request:

DELETE /api/reports/c228b656-e2b6-42b0-ae51-40e977dabc75 HTTP/1.1
Host: |localhost|

Example response:

HTTP/1.1 200 OK
Parameters:
  • id (string) – report’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Status Codes: