Graphs

Graphs scheme

Each graph is identified by its fields unique id and is associated with a specific chart identified by chart_id. Other description field is show that allow the specification of what datapoint series should be visualized, name for visualization and dashboard_id that identifies the dashboard that the graph belongs to.

Graph has to and belongs to only one dashboard. Graph without dashboard_id is not valid.

Graphs field target is automatically generated by the backend.

Scheme:

{
  "id": "UUID",
  "target": "String",
  "chart_id": "UUID",
  "show": "Array of String",
  "name": "String",
  "dashboard_id": "UUID",
  "chart_calibrated": "Boolean"
}

Example graph:

{
  "show": [
    "x",
    "lcl",
    "ucl"
  ],
  "id": "8a16c62d-6930-4621-802f-0f4e895d8de3",
  "target": "individual:one:2453fe7d-2c0f-46ae-be1a-cdd65af5c4c0"
  "chart_id": "2453fe7d-2c0f-46ae-be1a-cdd65af5c4c0",
  "name": "individual one",
  "dashboard_id": "98d4a715-86be-4ae9-b43a-09de615241fc",
  "chart_calibrated": false
}

GET methods

GET /api/v1/graphs

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

Example request:

GET /api/v1/graphs HTTP/1.1
Host: https://ccharts.hir.facts4.work/

Example response:

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

{
    "data": [
      {
          "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
      }
  ]
}
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Array of Objects:
 
  • id (string) – id of the graph
  • chart_id (string) – UUID of the chart to which the graph is associated
  • show (array) – array of datapoint targets to show
  • target (string) – generated target to be used with datasource endpoint
  • dashboard_id (string) – UUID of the dashboard to which the graph belongs
  • name (string) – generated name of the graph
  • chart_calibrated (boolean) – if the chart that the graph refers to is calibrated
Status Codes:
GET /api/v1/graphs/:id

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

Example request:

GET /api/v1/graphs/05641ca6-b7e4-4911-a5c8-38a9c2b611d9 HTTP/1.1
Host: https://ccharts.hir.facts4.work/

Example response:

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

{
    "data": {
      "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
  }
}
Parameters:
  • id (string) – graph’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Array of Objects:
 
  • id (string) – id of the graph
  • chart_id (string) – UUID of the chart to which the graph is associated
  • show (array) – array of datapoint targets to show
  • target (string) – generated target to be used with datasource endpoint
  • dashboard_id (string) – UUID of the dashboard to which the graph belongs
  • name (string) – generated name of the graph
  • chart_calibrated (boolean) – if the chart that the graph refers to is calibrated
Status Codes:

POST methods

POST /api/v1/graphs

Adds a new graph with its required fields.

The graph can be created by giving it a type of chart that we want to use and metric on which we want to create it, and dashboard_id that it belongs to.

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

Example request:

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

{
    "graph": {
        "dashboard_id": "98d4a715-86be-4ae9-b43a-09de615241fc",
        "type": "individual control limits",
        "metric": "two"
    }
}

Example response:

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

{
    "data": {
        "dashboard_id": "98d4a715-86be-4ae9-b43a-09de615241fc",
        "target": "individual:two:43ac8a94-46e0-4523-91a1-1e1f216ba0c4",
        "show": [
            "mean",
            "LCL",
            "UCL",
            "specification LCL",
            "specification UCL",
            "out_of_limits",
            "out_of_specifics",
            "unbalanced",
            "inside_sigma_2_3",
            "outside_sigma",
            "monotonic"
        ],
        "name": "individual two",
        "id": "d37f74d1-9a56-4cb6-bd6a-3e5066d80034",
        "chart_id": "43ac8a94-46e0-4523-91a1-1e1f216ba0c4",
        "chart_calibrated": false
    }
}
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Array of Objects:
 
  • dashboard_id (string) – UUID of the dashboard to which the graph belongs
  • type (string) – type of chart that we want to graph
  • metric (string) – metric that we want to graph
  • show (array) – array of datapoint targets to show
Response JSON Array of Objects:
 
  • id (string) – id of the graph
  • chart_id (string) – UUID of the chart to which the graph is associated
  • show (array) – array of datapoint targets to show
  • target (string) – generated target to be used with datasource endpoint
  • dashboard_id (string) – UUID of the dashboard to which the graph belongs
  • name (string) – generated name of the graph
  • chart_calibrated (boolean) – if the chart that the graph refers to is calibrated
Status Codes:

PUT methods

PUT /api/v1/graphs/:id

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

Example request:

PUT /api/v1/graphs/8a16c62d-6930-4621-802f-0f4e895d8de3 HTTP/1.1
Host: https://ccharts.hir.facts4.work/
Content-Type: application/json

{
    "graph": {
            "type": "individual control limits",
            "dashboard_id": "98d4a715-86be-4ae9-b43a-09de615241fc",
            "metric": "three",
            "show": [
              "mean",
              "LCL",
              "UCL"
            ]
    }
}

Example response:

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

{
    "data": {
        "target": "individual:three:9f0d9617-1e5d-4d47-bde4-250c0c4df443",
        "dashboard_id": "98d4a715-86be-4ae9-b43a-09de615241fc",
        "show": [
            "mean",
            "LCL",
            "UCL"
        ],
        "name": "individual three",
        "id": "d37f74d1-9a56-4cb6-bd6a-3e5066d80034",
        "chart_id": "9f0d9617-1e5d-4d47-bde4-250c0c4df443",
        "chart_calibrated": false
    }
}
Parameters:
  • id (string) – graph’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Array of Objects:
 
  • dashboard_id (string) – UUID of the dashboard to which the graph belongs
  • type (string) – type of chart that we want to graph
  • metric (string) – metric that we want to graph
  • show (array) – array of datapoint targets to show
Response JSON Array of Objects:
 
  • id (string) – id of the graph
  • chart_id (string) – UUID of the chart to which the graph is associated
  • show (array) – array of datapoint targets to show
  • target (string) – generated target to be used with datasource endpoint
  • dashboard_id (string) – UUID of the dashboard to which the graph belongs
  • name (string) – generated name of the graph
  • chart_calibrated (boolean) – if the chart that the graph refers to is calibrated
Status Codes:

DELETE methods

DELETE /api/v1/graphs/:id

Delete an existing graph, 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/graphs/8a16c62d-6930-4621-802f-0f4e895d8de3 HTTP/1.1
Host: https://ccharts.hir.facts4.work/

Example response:

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