Dashboards

Dashboards scheme

Each dashboard is identified by its fields unique id and is associated with a number of graphs identified by the graphs array of graph’s ids.

Other description fields include the dashboard’s layout, from, until and update used for visualization.

Scheme:

{
    "id": "UUID",
    "layout": "String",
    "graphs": "Array of Graph",
    "from": "String",
    "until": "String",
    "update": "String",
    "name": "String",
    "template_id:" "UUID",
    "part_id:" "String"
}

Example chart:

{
    "id": "26a73f1d-a6d3-4569-b339-5c965ddce0a8",
    "layout": "wide",
    "graphs": [
        {
            "show": [
                "x",
                "lcl"
            ],
            "id": "8a16c62d-6930-4621-802f-0f4e895d8de3",
            "chart_id": "2453fe7d-2c0f-46ae-be1a-cdd65af5c4c0"
        }
    ],
    "update": "5s",
    "until": "-10min",
    "from": "-8h",
    "name": "dashboard one",
    "template_id": null,
    "part_id": null
}

GET methods

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://ccharts.hir.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": [
                      {
                          "target": "individual:one:d2b7df78-8224-43ed-9d9a-fd35b5ad9ec9",
                          "show": [
                              "mean",
                              "LCL",
                              "UCL"
                          ],
                          "name": "individual one",
                          "id": "05641ca6-b7e4-4911-a5c8-38a9c2b611d9",
                          "dashboard_id": "98d4a715-86be-4ae9-b43a-09de615241fc",
                          "chart_id": "d2b7df78-8224-43ed-9d9a-fd35b5ad9ec9",
                          "chart_calibrated": false
                      }
                  ],
                  "from": "-8h"
              }
    ]
}
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Array of Objects:
 
  • id (string) – id of the dashboard
  • layout (string) – define the layout used by the frontend
  • graphs (array) – array of graphs composing the dashboard
  • from (string) – time string used to query the datasource (relative or absolute)
  • until (string) – time string used to query the datasource (relative or absolute)
  • update (string) – update interval for refreshing the datasource
  • name (string) – name of the dashboard
  • part_id (string) – part on which to base the template
  • template_id (string) – template to use to generate graphs
Status Codes:
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://ccharts.hir.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": [
            {
                "target": "individual:one:d2b7df78-8224-43ed-9d9a-fd35b5ad9ec9",
                "show": [
                    "mean",
                    "LCL",
                    "UCL"
                ],
                "name": "individual one",
                "id": "05641ca6-b7e4-4911-a5c8-38a9c2b611d9",
                "dashboard_id": "98d4a715-86be-4ae9-b43a-09de615241fc",
                "chart_id": "d2b7df78-8224-43ed-9d9a-fd35b5ad9ec9",
                "chart_calibrated": false
            }
        ],
        "from": "-8h"
    }
}
Parameters:
  • id (string) – dashboard’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Array of Objects:
 
  • id (string) – id of the dashboard
  • layout (string) – define the layout used by the frontend
  • graphs (array) – array of graphs composing the dashboard
  • from (string) – time string used to query the datasource (relative or absolute)
  • until (string) – time string used to query the datasource (relative or absolute)
  • update (string) – update interval for refreshing the datasource
  • name (string) – name of the dashboard
  • part_id (string) – part on which to base the template
  • template_id (string) – template to use to generate graphs
Status Codes:

POST methods

POST /api/v1/dashboards

Adds a new dashboard with its required fields.

Only required fields are layout and name, but others can be passed too. In order to assign the graph to a dashboard, you need to modify the graph directly since a graph can be created only related to a dashboard and can belong to only one.

A dashboard can be created from a template by passing in template_id and part_id that will be used to generate the dashboards graphs. It is not guaranteed that all graphs will be created, since for some no metric could be found, in that case only the graphs that are created will be included. If no graphs are created that clearly the part_id is not well defined and the dashboard is not created.

Returns the newly created resource or error message if the request was not valid.

Example request empty dashboard:

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

{
    "dashboard": {
        "layout": "wide",
        "name": "dashboard three"
    }
}

Example response:

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

{
    "data": {
        "update": "10s",
        "until": "0s",
        "template_id": null,
        "part_id": null,
        "name": "dashboard three",
        "layout": "wide",
        "id": "fe849eb4-a991-4bed-9b66-c8a5b2d331a6",
        "graphs": [],
        "from": "-1d"
    }
}

Example request dashboard from template:

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

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

Example response:

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

{
    "data": {
        "update": "10s",
        "until": "0s",
        "template_id": "12618492-27ed-4108-8398-479274adfd32",
        "part_id": "t",
        "name": "dashboard templated",
        "layout": "wide",
        "id": "0516a894-6ca6-42e2-b6cc-1fe9033ce185",
        "graphs": [
            {
                "target": "test:two:61455b8c-6a74-4ef3-86a6-b17c18616c9a",
                "show": [
                    "mean",
                    "LCL",
                    "UCL",
                    "specification LCL",
                    "specification UCL",
                    "out_of_limits",
                    "out_of_specifics",
                    "unbalanced",
                    "inside_sigma_2_3",
                    "outside_sigma",
                    "monotonic"
                ],
                "name": "test.type two",
                "id": "cb2cb00b-b2da-4830-a6db-9b6c7ec0b1eb",
                "dashboard_id": "0516a894-6ca6-42e2-b6cc-1fe9033ce185",
                "chart_id": "61455b8c-6a74-4ef3-86a6-b17c18616c9a",
                "chart_calibrated": false
            },
            {
                "target": "test:three:b9d6fd2c-8d36-4c3c-b491-c18965523ae9",
                "show": [
                    "mean",
                    "LCL",
                    "UCL",
                    "specification LCL",
                    "specification UCL",
                    "out_of_limits",
                    "out_of_specifics",
                    "unbalanced",
                    "inside_sigma_2_3",
                    "outside_sigma",
                    "monotonic"
                ],
                "name": "test.type t2",
                "id": "886f3788-14d6-4b54-ae1b-117e3cd974c5",
                "dashboard_id": "0516a894-6ca6-42e2-b6cc-1fe9033ce185",
                "chart_id": "b9d6fd2c-8d36-4c3c-b491-c18965523ae9",
                "chart_calibrated": true
            }
        ],
        "from": "-1d"
    }
}
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Array of Objects:
 
  • layout (string) – define the layout used by the frontend
  • from (string) – time string used to query the datasource (relative or absolute)
  • until (string) – time string used to query the datasource (relative or absolute)
  • update (string) – update interval for refreshing the datasource
  • name (string) – name of the dashboard
  • part_id (string) – part on which to base the template
  • template_id (string) – template to use to generate graphs
Response JSON Array of Objects:
 
  • id (string) – id of the dashboard
  • layout (string) – define the layout used by the frontend
  • graphs (array) – array of graphs composing the dashboard
  • from (string) – time string used to query the datasource (relative or absolute)
  • until (string) – time string used to query the datasource (relative or absolute)
  • update (string) – update interval for refreshing the datasource
  • name (string) – name of the dashboard
  • part_id (string) – part on which to base the template
  • template_id (string) – template to use to generate graphs
Status Codes:

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

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

Example response:

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

{
    "data": {
        "layout": "wide",
        "id": "77e79dce-5a36-481f-a19a-cf2f80ed4673",
        "graphs": [],
        "update": "5s",
        "until": "-10min",
        "from": "-8h"
        "template_id": "12618492-27ed-4108-8398-479274adfd32",
        "part_id": "t",
        "name": "dashboard templated",
    }
}
Parameters:
  • id (string) – dashboard’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Array of Objects:
 
  • layout (string) – define the layout used by the frontend
  • graphs (array) – array of graphs composing the dashboard
  • from (string) – time string used to query the datasource (relative or absolute)
  • until (string) – time string used to query the datasource (relative or absolute)
  • update (string) – update interval for refreshing the datasource
Response JSON Array of Objects:
 
  • id (string) – id of the dashboard
  • layout (string) – define the layout used by the frontend
  • graphs (array) – array of graphs composing the dashboard
  • from (string) – time string used to query the datasource (relative or absolute)
  • until (string) – time string used to query the datasource (relative or absolute)
  • update (string) – update interval for refreshing the datasource
  • name (string) – name of the dashboard
  • part_id (string) – part on which to base the template
  • template_id (string) – template to use to generate graphs
Status Codes:

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://ccharts.hir.facts4.work/

Example response:

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