Solutions

Version 1.2.0

New fields have been added to the solutions: media_url and optionals

Solutions scheme

Each solution is identified by its unique id. A solution is defined for a certain defect identified by defect_id which is defined for a certain part. Additionally name, desc and comment fields are non unique strings used for greater readability and additional information. Each solution contains a collection of skills needed to apply it. In addition each solution has a success_rate and rating that can be used to order solutions.

Scheme:

{
  "id": "UUID",
  "defect_id": "UUID",
  "name": "String",
  "desc": "String",
  "comment": "String",
  "skill": "JSON",
  "success_rate": "Float",
  "rating": "Integer",
  "media_url": "String",
  "optionals": "JSON"
}

Example solution:

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "defect_id": "0fc6d020-7f96-4424-9005-9e691d9c90e5",
  "name": "Change machine parameter",
  "desc": "Poor surface quality defect can be resolved by increasing the machine thickness parameter by +2",
  "comment": "Easy and straightforward solution, change thickness parameter further if defect presents itself again",
  "skill": {
    "machine": 3,
    "tool": 3
  },
  "success_rate": 79.0,
  "rating": 90,
  "media_url": "http://url.to.the/solution",
  "optionals": {}
}

This example solution tells us for what defect it can be applied, how to do it and what skills are necessary by the operator to do it.

GET methods

GET /api/solutions

Returns all solutions 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.

Optional query parameter id defect_id. If provided the response is a collection of solutions relative to the specific defect.

Example request:

GET /api/solutions 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": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
    "defect_id": "0fc6d020-7f96-4424-9005-9e691d9c90e5",
    "name": "Change machine parameter",
    "desc": "Poor surface quality defect can be resolved by increasing the machine thickness parameter by +2",
    "comment": "Easy and straightforward solution, change thickness parameter further if defect presents itself again",
    "skill": {
            "machine": 3,
            "tool": 3
    },
    "success_rate": 79.0,
    "rating": 90,
    "media_url": "http://url.to.the/solution",
    "optionals": {}
  },
            {
                "id": "986c6f2e-7c49-4c0b-9bb3-9566ea3e9b02",
                "defect_id": "5880f2f1-e548-4db5-9ef3-3e23954689f4",
                "name": "Change machine parameter",
                "desc": "Poor mechanical quality defect can be resolved by increasing the machine pressure parameter",
                "comment": "Easy and straightforward solution",
                "skill": {
                    "machine": 3,
                    "tool": 2,
                    "computer": 1
                },
    "success_rate": 75.0,
    "rating": 90,
    "media_url": "http://url.to.the/solution",
    "optionals": {}
              }
]
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
  • page (integer) – page number, 10 resources per page are returned, default is 1
  • defect_id (string) – optional defect id for which solutions are returned
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 solution
  • defect_id (string) – id of the defect that is resolved with this solution
  • name (string) – name of the solution
  • desc (string) – description of the solution
  • comment (string) – comment by staff that registered, applied, etc. the solution
  • skill (string) – skill JSON object of requirements to implement the solution
  • success_rate (float) – the percentage of the times a solution has worked so far
  • rating (integer) – a rating given to a solution
  • media_url (string) – url to the solution media
  • optionals (JSON) – any optional information that does not fall in existing fields
Status Codes:
GET /api/solutions/:id

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

Example request:

GET /api/solutions/ae54af76-964f-4ed8-8700-793b2ed5c20b HTTP/1.1
Host: |localhost|

Example response:

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

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "defect_id": "0fc6d020-7f96-4424-9005-9e691d9c90e5",
  "name": "Change machine parameter",
  "desc": "Poor surface quality defect can be resolved by increasing the machine thickness parameter by +2",
  "comment": "Easy and straightforward solution, change thickness parameter further if defect presents itself again",
  "skill": {
    "machine": 3,
    "tool": 3
  },
  "success_rate": 79.0,
  "rating": 90,
  "media_url": "http://url.to.the/solution",
  "optionals": {}
}
Parameters:
  • id (string) – solution’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Object:
 
  • id (string) – id of the solution
  • defect_id (string) – id of the defect that is resolved with this solution
  • name (string) – name of the solution
  • desc (string) – description of the solution
  • comment (string) – comment by staff that registered, applied, etc. the solution
  • skill (string) – skill JSON object of requirements to implement the solution
  • success_rate (float) – the percentage of the times a solution has worked so far
  • rating (integer) – a rating given to a solution
Response JSON Array of Objects:
 
  • media_url (string) – url to the solution media
  • optionals (JSON) – any optional information that does not fall in existing fields
Status Codes:

POST methods

POST /api/solutions

Adds a new solution with its defect_id, name, desc, comment and skill. 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/solutions HTTP/1.1
Host: |localhost|
Content-Type: application/json

{
  "defect_id": "0fc6d020-7f96-4424-9005-9e691d9c90e5",
  "name": "Change machine parameter",
  "desc": "Poor surface quality defect can be resolved by increasing the machine thickness parameter by +2",
  "comment": "Easy and straightforward solution, change thickness parameter further if defect presents itself again",
  "skill": {
    "machine": 3,
    "tool": 3
  },
  "rating": 90,
  "media_url": "http://url.to.the/solution",
  "optionals": {}
}

Example response:

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

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "defect_id": "0fc6d020-7f96-4424-9005-9e691d9c90e5",
  "name": "Change machine parameter",
  "desc": "Poor surface quality defect can be resolved by increasing the machine thickness parameter by +2",
  "comment": "Easy and straightforward solution, change thickness parameter further if defect presents itself again",
  "skill": {
    "machine": 3,
    "tool": 3
  },
  "success_rate": 0.0,
  "rating": 90,
  "media_url": "http://url.to.the/solution",
  "optionals": {}
}
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Object:
 
  • defect_id (string) – defect id on which a solution is to be applied
  • name (string) – solution’s name
  • desc (string) – solution’s description
  • comment (string) – comment of the operator that proposed or applied the solution
  • skill (json) – a collection of skills required to use this solution
  • rating (integer) – a rating given to a solution
Request JSON Array of Objects:
 
  • media_url (string) – url to the solution media
  • optionals (JSON) – any optional information that does not fall in existing fields
Response JSON Object:
 
  • id (string) – id of the solution
  • defect_id (string) – id of the defect that is resolved with this solution
  • name (string) – name of the solution
  • desc (string) – description of the solution
  • comment (string) – comment by staff that registered, applied, etc. the solution
  • skill (string) – skill JSON object of requirements to implement the solution
  • success_rate (float) – the percentage of the times a solution has worked so far
  • rating (integer) – a rating given to a solution
Response JSON Array of Objects:
 
  • media_url (string) – url to the solution media
  • optionals (JSON) – any optional information that does not fall in existing fields
Status Codes:

PUT methods

PUT /api/solutions/:id

Updates an existing solution 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/solutions/ae54af76-964f-4ed8-8700-793b2ed5c20b HTTP/1.1
Host: |localhost|
Content-Type: application/json

{
  "defect_id": "0fc6d020-7f96-4424-9005-9e691d9c90e5",
  "name": "Change machine parameter",
  "desc": "Poor surface quality defect can be resolved by increasing the machine thickness parameter by +2",
  "comment": "Easy and straightforward solution, change thickness parameter further if defect presents itself again",
  "skill": {
    "machine": 3,
    "tool": 3
  },
  "success_rate": 0.0,
  "rating": 90,
  "media_url": "http://url.to.the/solution",
  "optionals": {}
}

Example response:

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

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "defect_id": "0fc6d020-7f96-4424-9005-9e691d9c90e5",
  "name": "Change machine parameter",
  "desc": "Poor surface quality defect can be resolved by increasing the machine thickness parameter by +2",
  "comment": "Easy and straightforward solution, change thickness parameter further if defect presents itself again",
  "skill": {
    "machine": 3,
    "tool": 3
  },
  "success_rate": 0.0,
  "rating": 90,
  "media_url": "http://url.to.the/solution",
  "optionals": {}
}
Parameters:
  • id (string) – solution’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Object:
 
  • defect_id (string) – defect id on which a solution is to be applied
  • name (string) – solution’s name
  • desc (string) – solution’s description
  • comment (string) – comment of the operator that proposed or applied the solution
  • skill (json) – a collection of skills required to use this solution
  • rating (integer) – a rating given to a solution
Request JSON Array of Objects:
 
  • media_url (string) – url to the solution media
  • optionals (JSON) – any optional information that does not fall in existing fields
Response JSON Object:
 
  • id (string) – id of the solution
  • defect_id (string) – id of the defect that is resolved with this solution
  • name (string) – name of the solution
  • desc (string) – description of the solution
  • comment (string) – comment by staff that registered, applied, etc. the solution
  • skill (string) – skill JSON object of requirements to implement the solution
  • success_rate (float) – the percentage of the times a solution has worked so far
  • rating (integer) – a rating given to a solution
Response JSON Array of Objects:
 
  • media_url (string) – url to the solution media
  • optionals (JSON) – any optional information that does not fall in existing fields
Status Codes:

DELETE methods

DELETE /api/solutions/:id

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

Example request:

DELETE /api/solutions/ae54af76-964f-4ed8-8700-793b2ed5c20b HTTP/1.1
Host: |localhost|

Example response:

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