THO Inspections

Used to display clusters of machine/part with their failure rate.

GET methods

GET /api/v1/inspections

Return failure rate for machine/product couple over the last 24 hours.

Accepts from and to dates in iso 8601 format, or relative graphite format, as query parameters to return inspections for a different timeframe.

Accepts target parameter with one of params or measures to filter which feature type to inspect.

Example request:

GET /api/v1/inspections?from=2018-04-15&to=2018-04-16 HTTP/1.1
Host: https://api.facts4.work/

Example response:

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

{
    "range": {
            "from": "2018-04-15",
            "to": "2018-04-16"
    },
    "data": [
            {
                    "machine": 15,
                    "product": 54601,
                    "failure": {
                            "parameters": 49.65,
                            "measures": 10.43
                    },
                    "inspections": [
                            203999
                    ]

            },
            {
                    "machine": 15,
                    "product": 55609,
                    "failure": {
                            "parameters": 7.65,
                            "measures": 3.43
                    },
                    "inspections": [
                            204132,
                            204133
                    ]

            },
            ...
    ]
}
Query Parameters:
 
  • from – date in ISO 8601 format, or graphite format, select inspections after this date (inclusive)
  • to – date ins ISO 8601 format, or graphite format, select inspections before this date (inclusive)
  • target – one of params or measures
  • machine (string) – machine number for filtering
  • product (string) – product number for filtering
Status Codes:
GET /api/v1/aggregate/batch_id

Return aggregate failure rate for a batch id.

The lists of available batch id can be found in the response from /api/inspections.

Example request:

GET /api/v1/aggregate/203999 HTTP/1.1
Host: https://api.facts4.work/

Example response:

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

{
    "range": {
            "from": "2018-04-15",
            "to": "2018-04-16"
    },
    "product": 54601,
    "machine": 15,
    "inspections": [
            20399
    ],
    "params": [
            {
                    "label": "mm/s",
                    "failure": 10.1,
                    "features": [
                            {
                                    "label": "Feature 1",
                                    "failure": 4.3,
                                    "feature_id": 94174
                            },
                            {
                                    "label": "Feature 2",
                                    "failure": 2.3,
                                    "feature_id": 94175
                            },
                            ...
                    ]
            },
            ...
    ],
    "measures": [
            {
                    "label": "mm/s",
                    "failure": 15.1,
                    "features": [
                            {
                                    "label": "Feature a",
                                    "failure": 9.3,
                                    "feature_id": 94177
                            },
                            {
                                    "label": "Feature b",
                                    "failure": 8.1,
                                    "feature_id": 94178
                            },
                            ...
                    ]
            },
            ...
    ]
}
Status Codes:
GET /api/v1/aggregate

Return the failure rate aggregation over the unit of measure.

Accepts from and to dates in iso 8601 format, or relative graphite format, as query parameters to return inspections for a different timeframe.

Accepts target parameter with one of params or measures to filter which feature type to inspect.

Accepts machine and product as a filter.

GET /api/v1/aggregate?from=2018-04-15&to=2018-04-18&target=params&machine=15&product=54601 HTTP/1.1
Host: https://api.facts4.work/

Example response:

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

{
    "range": {
            "from": "2018-04-15",
            "to": "2018-04-18"
    },
    "product": 54601,
    "machine": 15,
    "inspections": [
            20399,
            20400,
            20401
    ],
    "params": [
            {
                    "label": "mm/s",
                    "failure": 10.1,
                    "features": [
                            {
                                    "label": "Feature 1",
                                    "failure": 4.3,
                                    "feature_id": 99146
                            },
                            {
                                    "label": "Feature 2",
                                    "failure": 2.3,
                                    "feature_id": 99147
                            },
                            ...
                    ]
            },
            ...
    ],
    "measures": [
            {
                    "label": "mm/s",
                    "failure": 15.1,
                    "features": [
                            {
                                    "label": "Feature a",
                                    "failure": 9.3,
                                    "feature_id": 99149
                            },
                            {
                                    "label": "Feature b",
                                    "failure": 8.1,
                                    "feature_id": 99150
                            },
                            ...
                    ]
            },
            ...
    ]
}
Query Parameters:
 
  • from – date in ISO 8601 format, or graphite format, select inspections after this date (inclusive)
  • to – date ins ISO 8601 format, or graphite format, select inspections before this date (inclusive)
  • target (strin) – one of params or measures
  • machine (string) – machine number for filtering
  • product (string) – product number for filtering
GET /api/v1/dashboards

Returns all the dashboards with their relative information if at least one resource exists, otherwise returns an empty collection.

Example request:

GET /api/v1/dashboards HTTP/1.1
Host: https://api.facts4.work/

Example response:

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

{
    "data": [
              {
                  "update": "10s",
                  "until": "0s",
                  "template_id": null,
                  "part_id": null,
                  "name": "test",
                  "layout": "wide",
                  "id": "98d4a715-86be-4ae9-b43a-09de615241fc",
                  "graphs": [],
                  "from": "-8h",
                  "filter_by": "params"
              }
    ]
}
GET /api/v1/dashboards/:id

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

Example request:

GET /api/v1/dashboards/26a73f1d-a6d3-4569-b339-5c965ddce0a8 HTTP/1.1
Host: https://api.facts4.work/

Example response:

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

{
    "data": {
        "update": "10s",
        "until": "0s",
        "template_id": null,
        "part_id": null,
        "name": "test",
        "layout": "wide",
        "id": "98d4a715-86be-4ae9-b43a-09de615241fc",
        "graphs": [],
        "from": "-8h"
    }
}

POST methods

POST /api/v1/dashboards

Adds a new dashboard with its required fields.

Example request dashboard from template:

POST /api/v1/dashboards HTTP/1.1
Host: https://ccharts.hir.facts4.work/
Content-Type: application/json

{
    "layout": "wide",
    "name": "dashboard templated",
    "template_id": "12618492-27ed-4108-8398-479274adfd32",
    "part_id": "t",
    "filter_by": "params"
}

PUT methods

PUT /api/v1/dashboards/:id

Updates an existing dashboard with new information. Returns the updated resource or an error message.

Example request:

PUT /api/v1/dashboards/77e79dce-5a36-481f-a19a-cf2f80ed4673 HTTP/1.1
Host: https://ccharts.hir.facts4.work/
Content-Type: application/json

{
    "layout": "wide",
    "update": "5s",
    "until": "-10min",
    "from": "-8h"
}

DELETE methods

DELETE /api/v1/dashboards/:id

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

Example request:

DELETE /api/v1/dashboards/77e79dce-5a36-481f-a19a-cf2f80ed4673 HTTP/1.1
Host: https://api.facts4.work/