NAV

Introduction

Welcome to the Blockbax API Reference. Use the Blockbax API to easily get data in and out of Blockbax.

The Blockbax API uses REST which means the URLs are resource-oriented and HTTP status codes are used to indicate success or failure. Data returned from our API will be in JSON format for all requests. In code examples cURL is used to interact with our API, however for almost any language there are libraries available to integrate with a REST API.

Authentication

Blockbax uses API keys to allow access to the API. API keys can be created in the web app. Every request to the API needs to send an authorization header along that looks like the following:

Authorization: ApiKey <API_key>

Projects

This endpoint allows you to programmatically query projects.

Get a project

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"

curl "https://api.blockbax.com/v1/projects/${project_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "id": "715b6935-e3d8-48b1-86a3-a6e2a268e1f",
  "name": "My Project",
  "description": "This is my project",
  "timezoneId": "Europe/Amsterdam"
}

Fetch an existing project.

Parameters

This endpoint takes no arguments.

Property Types

This endpoint allows you to programmatically create, update, delete and query property types.

Search property types

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/propertyTypes

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"

curl "https://api.blockbax.com/v1/projects/${project_id}/propertyTypes"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "count": 1,
  "result": [
    {
      "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "name": "City",
      "type": "TEXT",
      "predefinedValues": true,
      "values": [
        {
          "id": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
          "value": "Amsterdam",
          "subjectIds": []
        },
        {
          "id": "6121933f-6f90-448e-86d2-ced335ac9172",
          "value": "Rotterdam",
          "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
        }
      ]
    }
  ]
}

Search and filter property types. Results are paginated with a maximum of 100 results at a time.

Parameters

Get a property type

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/propertyTypes/<PROPERTY_TYPE_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
property_type_id="08efb2ce-18d2-4aa1-9f8c-f745386ad1ac"

curl "https://api.blockbax.com/v1/projects/${project_id}/propertyTypes/${property_type_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "name": "City",
  "type": "TEXT",
  "predefinedValues": true,
  "values": [
    {
      "id": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
      "value": "Amsterdam",
      "subjectIds": []
    },
    {
      "id": "6121933f-6f90-448e-86d2-ced335ac9172",
      "value": "Rotterdam",
      "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
    }
  ]
}

Fetch an existing property type.

Parameters

This endpoint takes no arguments.

Create or update a property type

Create a new property type or update an existing one.

HTTP Request

Create
POST https://api.blockbax.com/v1/projects/<PROJECT_ID>/propertyTypes/

Update
PUT https://api.blockbax.com/v1/projects/<PROJECT_ID>/propertyTypes/<PROPERTY_TYPE_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
property_type_id="08efb2ce-18d2-4aa1-9f8c-f745386ad1ac"

curl -X POST "https://api.blockbax.com/v1/projects/${project_id}/propertyTypes/"
or
curl -X PUT "https://api.blockbax.com/v1/projects/${project_id}/propertyTypes/${property_type_id}"
  -H "Authorization: ApiKey ${api_key}"
  -d '{
        "name": "City",
        "type": "TEXT",
        "predefinedValues": true,
        "values": [
          {
            "id": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
            "value": "New Amsterdam",
          },
          {
            "id": "",
            "value": "Den Haag",
          }
        ]
      }'

Example response

{
  "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "name": "City",
  "type": "TEXT",
  "predefinedValues": true,
  "values": [
    {
      "id": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
      "value": "New Amsterdam",
      "subjectId": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
    },
    {
      "id": "6121933f-6f90-448e-86d2-ced335ac9172",
      "value": "Den Haag",
      "subjectIds": []
    }
  ]
}

Body

Delete a property type

Delete an existing property type.

HTTP Request

DELETE https://api.blockbax.com/v1/projects/<PROJECT_ID>/propertyTypes/<PROPERTY_TYPE_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
property_type_id="08efb2ce-18d2-4aa1-9f8c-f745386ad1ac"

curl -X DELETE "https://api.blockbax.com/v1/projects/${project_id}/propertyTypes/${property_type_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{}

Parameters

This endpoint takes no arguments.

Subject Types

This endpoint allows you to programmatically create, update, delete and query subject types.

Search subject types

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjectTypes

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"

curl "https://api.blockbax.com/v1/projects/${project_id}/subjectTypes"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "count": 1,
  "result": [
    {
      "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "name": "Transformer substation",
      "propertyTypes": [
        {
          "id": "bfdc883b-524f-43e2-bef6-0e8f63a1b7ce",
          "required": true,
          "visible": true
        },
        {
          "id": "50f381bf-eb46-4d73-9bfd-5bfb57db43d6",
          "required": false,
          "visible": true
        }
      ]
    }
  ]
}

Search and filter subject types. Results are paginated with a maximum of 100 results at a time.

Parameters

Get a subject type

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjectTypes/<SUBJECT_TYPE_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
subject_type_id="08efb2ce-18d2-4aa1-9f8c-f745386ad1ac"

curl "https://api.blockbax.com/v1/projects/${project_id}/subjectTypes/${subject_type_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "name": "Transformer substation",
  "propertyTypes": [
    {
      "id": "bfdc883b-524f-43e2-bef6-0e8f63a1b7ce",
      "required": true,
      "visible": true
    },
    {
      "id": "50f381bf-eb46-4d73-9bfd-5bfb57db43d6",
      "required": false,
      "visible": false
    }
  ]
}

Fetch an existing subject type.

Parameters

This endpoint takes no arguments.

Create or update a subject type

Create a new subject type or update an existing one.

HTTP Request

Create
POST https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjectTypes/

Update
PUT https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjectTypes/<SUBJECT_TYPE_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
subject_type_id="08efb2ce-18d2-4aa1-9f8c-f745386ad1ac"

curl -X POST "https://api.blockbax.com/v1/projects/${project_id}/subjectTypes/"
or
curl -X PUT "https://api.blockbax.com/v1/projects/${project_id}/subjectTypes/${subject_type_id}"
  -H "Authorization: ApiKey ${api_key}"
  -d '{
        "name": "Transformer substation",
        "propertyTypes": [
          {
            "id": "bfdc883b-524f-43e2-bef6-0e8f63a1b7ce",
            "required": true,
            "visible": true
          },
          {
            "id": "50f381bf-eb46-4d73-9bfd-5bfb57db43d6",
            "required": false,
            "visible": false
          }
        ]
      }'

Example response

{
  "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "name": "Transformer substation",
  "propertyTypes": [
    {
      "id": "bfdc883b-524f-43e2-bef6-0e8f63a1b7ce",
      "required": true,
      "visible": true
    },
    {
      "id": "50f381bf-eb46-4d73-9bfd-5bfb57db43d6",
      "required": false,
      "visible": false
    }
  ]
}

Body

Delete a subject type

Delete an existing subject type.

HTTP Request

DELETE https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjectTypes/<SUBJECT_TYPE_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
subject_type_id="08efb2ce-18d2-4aa1-9f8c-f745386ad1ac"

curl -X DELETE "https://api.blockbax.com/v1/projects/${project_id}/subjectTypes/${subject_type_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{}

Parameters

This endpoint takes no arguments.

Subjects

This endpoint allows you to programmatically create, update, delete and query subjects.

Search subjects

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjects

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"

curl "https://api.blockbax.com/v1/projects/${project_id}/subjects"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "count": 2,
  "result": [
    {
      "id": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
      "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "name": "My house",
      "externalId": "MyHouse",
      "ingestionIds": [
        {
          "metricId" : "7c40cc50-aa51-4eb2-8937-71ce62798f17", "deriveIngestionId" : false, "ingestionId" : "MyIngestionId"
        },
        {
          "metricId" : "7f43ba7b-2c80-4e4f-b2b6-4f7fecd0311", "deriveIngestionId" : true, "ingestionId" : "MyHouse$MetricId"
        }
      ],
      "properties": [
        {
        "typeId" : "b04fe3ba-02d2-45cd-8359-d3211d77685f", "valueId" : "ad80f927-2f40-405d-aed6-9a8f9b91f82a", "value" : "MyValue"
        },
        {
        "typeId" : "34a50cb8-517c-43fb-9397-b0159e5c692e", "valueId" : "861d2845-e90a-473b-954f-19965277fce4", "value" : "PreExistingValue"
        }
      ]
    },
    {
      "id": "e889593b-d07d-4c53-a83f-3458e8e04a98",
      "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "name": "My office",
      "externalId": "MyOffice",
      "ingestionIds": [
        {
          "metricId" : "7c40cc50-aa51-4eb2-8937-71ce62798f17", "deriveIngestionId" : false, "ingestionId" : "MyIngestionId"
        },
        {
          "metricId" : "7f43ba7b-2c80-4e4f-b2b6-4f7fecd0311", "deriveIngestionId" : true, "ingestionId" : "MyOffice$MetricId"
        }
      ],
      "properties": [
        {
        "typeId" : "b04fe3ba-02d2-45cd-8359-d3211d77685f", "valueId" : "ad80f927-2f40-405d-aed6-9a8f9b91f82a", "value" : "MyValue"
        },
        {
        "typeId" : "34a50cb8-517c-43fb-9397-b0159e5c692e", "valueId" : "861d2845-e90a-473b-954f-19965277fce4", "value" : "PreExistingValue"
        }
      ]
    }
  ]
}

Search and filter subjects. Results are paginated with a maximum of 100 results at a time.

Parameters

Get a subject

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjects/<SUBJECT_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
subject_id="f59ee376-ccec-40e1-8ebe-38bef7a30ac9"

curl "https://api.blockbax.com/v1/projects/${project_id}/subjects/${subject_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "id": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
  "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "name": "My house",
  "externalId": "MyHouse",
  "ingestionIds": [
    {
    "metricId" : "7c40cc50-aa51-4eb2-8937-71ce62798f17", "deriveIngestionId" : false, "ingestionId" : "MyIngestionId"
    },
    {
    "metricId" : "7f43ba7b-2c80-4e4f-b2b6-4f7fecd0311", "deriveIngestionId" : true, "ingestionId" : "MyHouse$MetricId"
    }
  ],
  "properties": [
    {
    "typeId" : "b04fe3ba-02d2-45cd-8359-d3211d77685f", "valueId" : "ad80f927-2f40-405d-aed6-9a8f9b91f82a", "value" : "MyValue"
    },
    {
    "typeId" : "34a50cb8-517c-43fb-9397-b0159e5c692e", "valueId" : "861d2845-e90a-473b-954f-19965277fce4", "value" : "PreExistingValue"
    }
  ]
}

Fetch an existing subject.

Parameters

This endpoint takes no arguments.

Create or update a subject

HTTP Request

Create
POST https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjects/

Update
PUT https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjects/<SUBJECT_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
subject_id="f59ee376-ccec-40e1-8ebe-38bef7a30ac9"

curl -X POST "https://api.blockbax.com/v1/projects/${project_id}/subjects/"
or
curl -X PUT "https://api.blockbax.com/v1/projects/${project_id}/subjects/${subject_id}"
  -H "Authorization: ApiKey ${api_key}"
  -d '{
        "name": "My house",
        "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
        "externalId": "MyHouse",
        "ingestionIds": [
          {
            "metricId" : "7c40cc50-aa51-4eb2-8937-71ce62798f17", "deriveIngestionId" : false, "ingestionId" : "MyIngestionId"
          },
          {
            "metricId" : "7f43ba7b-2c80-4e4f-b2b6-4f7fecd0311", "deriveIngestionId" : true
          }
        ]
        "properties": [
          {
            "typeId" : "b04fe3ba-02d2-45cd-8359-d3211d77685f", "value" : "MyValue"
            },
            {"typeId" : "34a50cb8-517c-43fb-9397-b0159e5c692e", "valueId" : "861d2845-e90a-473b-954f-19965277fce4"
          }
        ]
      }'

Example response

{
  "id": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
  "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "name": "My house",
  "externalId": "MyHouse",
  "ingestionIds": [
    {
    "metricId" : "7c40cc50-aa51-4eb2-8937-71ce62798f17", "deriveIngestionId" : false, "ingestionId" : "MyIngestionId"
    },
    {
    "metricId" : "7f43ba7b-2c80-4e4f-b2b6-4f7fecd0311", "deriveIngestionId" : true, "ingestionId" : "MyHouse$MetricId"
    }
  ],
  "properties": [
    {
    "typeId" : "b04fe3ba-02d2-45cd-8359-d3211d77685f", "valueId" : "ad80f927-2f40-405d-aed6-9a8f9b91f82a", "value" : "MyValue"
    },
    {
    "typeId" : "34a50cb8-517c-43fb-9397-b0159e5c692e", "valueId" : "861d2845-e90a-473b-954f-19965277fce4", "value" : "PreExistingValue"
    }
  ]
}

Create a new subject or update an existing one.

Body

Delete a subject

Delete an existing subject.

HTTP Request

DELETE https://api.blockbax.com/v1/projects/<PROJECT_ID>/subjects/

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
subject_id="f59ee376-ccec-40e1-8ebe-38bef7a30ac9"

curl -X DELETE "https://api.blockbax.com/v1/projects/${project_id}/subjects/${subject_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{}

Parameters

This endpoint takes no arguments.

Metrics

This endpoint allows you to programmatically create, update, delete and query metrics.

Search metrics

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/metrics

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"

curl "https://api.blockbax.com/v1/projects/${project_id}/metrics"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "count": 2,
  "result": [
    {
      "id": "7c40cc50-aa51-4eb2-8937-71ce62798f17",
      "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "name": "Temperature living room",
      "unit": "°C",
      "precision": 2,
      "visible": true,
      "type": "INGESTED",
      "externalId": "LivingRoomTemperature"
    },
    {
      "id": "7f43ba7b-2c80-4e4f-b2b6-4f7fecd03116",
      "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "name": "Humidity living room",
      "unit": "%",
      "precision": 2,
      "visible": true,
      "type": "INGESTED",
      "externalId": "LivingRoomHumidity"
    }
  ]
}

Search and filter metrics. Results are paginated with a maximum of 100 results at a time.

Parameters

Get a metric

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/metrics/<METRIC_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
metric_id="7c40cc50-aa51-4eb2-8937-71ce62798f17"

curl "https://api.blockbax.com/v1/projects/${project_id}/metrics/${metric_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "id": "7c40cc50-aa51-4eb2-8937-71ce62798f17",
  "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "name": "Temperature living room",
  "unit": "°C",
  "precision": 2,
  "visible": true,
  "type": "INGESTED",
  "externalId": "LivingRoomTemperature",
}

Fetch an existing metric.

Parameters

This endpoint takes no arguments.

Create or update a metric

Create a new metric or update an existing one.

HTTP Request

Create
POST https://api.blockbax.com/v1/projects/<PROJECT_ID>/metrics/

Update
PUT https://api.blockbax.com/v1/projects/<PROJECT_ID>/metrics/<METRIC_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
metric_id="7c40cc50-aa51-4eb2-8937-71ce62798f17"

curl -X POST "https://api.blockbax.com/v1/projects/${project_id}/metrics/"
or
curl -X PUT "https://api.blockbax.com/v1/projects/${project_id}/metrics/${metric_id}"
  -H "Authorization: ApiKey ${api_key}"
  -d '{
        "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
        "name": "Temperature living room",
        "unit": "°C",
        "precision": 2,
        "visible": true,
        "type": "INGESTED",
        "externalId": "LivingRoomTemperature",
      }'

Example response

{
  "id": "e2e5a8e4-ac23-4821-8ab7-18f994ec674d",
  "name": "Temperature living room",
  "unit":"°C",
  "precision": 2,
  "visible": true,
  "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "type": "INGESTED",
  "externalId": "LivingRoomTemperature",
}

Body

Delete a metric

Delete an existing metric.

HTTP Request

DELETE https://api.blockbax.com/v1/projects/<PROJECT_ID>/metrics/<METRIC_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
metric_id="7c40cc50-aa51-4eb2-8937-71ce62798f17"

curl -X DELETE "https://api.blockbax.com/v1/projects/${project_id}/metrics/${metric_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{}

Parameters

This endpoint takes no arguments.

Event Triggers

This endpoint allows you to programmatically create, update, delete and query event triggers.

Search event triggers

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/eventTriggers

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"

curl "https://api.blockbax.com/v1/projects/${project_id}/eventTriggers"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "count": 1,
  "result": [
    {
      "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
      "metricIds": ["7c40cc50-aa51-4eb2-8937-71ce62798f17"],
      "name": "Temperature",
      "version": 1,
      "archived": false,
      "latestVersion": true,
      "eventRules": [
        {
          "valueType": "MEASUREMENT_VALUE",
          "operator": "EQUALS",
          "value": 20,
          "eventLevel": "PROBLEM"
        },
        {
          "valueType": "MEASUREMENT_VALUE",
          "operator": "GREATER_THAN",
          "value": 22,
          "eventLevel": "WARNING",
          "durationConstraint": {
            "periodValue": 30,
            "periodUnit": "MINUTES"
          },
          "occurrencesConstraint": {
            "occurrences": 10,
            "periodValue": 1,
            "periodUnit": "HOURS"
          },
          "timeConstraint": {
            "startTime": "08:00",
            "endTime": "17:00"
          }
        },
        {
          "valueType": "MEASUREMENT_VALUE",
          "operator": "LESS_THAN_OR_EQUALS",
          "value": 18,
          "eventLevel": "INFORMATION"
        }
      ]
    }
  ]
}

Search and filter event triggers. Results are paginated with a maximum of 100 results at a time.

Parameters

Get an event trigger

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/eventTriggers/<EVENT_TRIGGER_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
event_trigger_id="08efb2ce-18d2-4aa1-9f8c-f745386ad1ac"

curl "https://api.blockbax.com/v1/projects/${project_id}/eventTriggers/${event_trigger_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
  "metricIds": ["7c40cc50-aa51-4eb2-8937-71ce62798f17"],
  "name": "Temperature",
  "version": 1,
  "archived": false,
  "latestVersion": true,
  "eventRules": [
    {
      "valueType": "MEASUREMENT_VALUE",
      "operator": "EQUALS",
      "value": 20,
      "eventLevel": "PROBLEM"
    },
    {
      "valueType": "MEASUREMENT_VALUE",
      "operator": "GREATER_THAN",
      "value": 22,
      "eventLevel": "WARNING",
      "durationConstraint": {
        "periodValue": 30,
        "periodUnit": "MINUTES"
      },
      "occurrencesConstraint": {
        "occurrences": 10,
        "periodValue": 1,
        "periodUnit": "HOURS"
      },
      "timeConstraint": {
        "startTime": "08:00",
        "endTime": "17:00"
      }
    },
    {
      "valueType": "MEASUREMENT_VALUE",
      "operator": "LESS_THAN_OR_EQUALS",
      "value": 18,
      "eventLevel": "INFORMATION"
    }
  ]
}

Fetch an existing event trigger.

Parameters

This endpoint takes no arguments.

Create or update an event trigger

Create a new event trigger or update an existing one.

HTTP Request

Create
POST https://api.blockbax.com/v1/projects/<PROJECT_ID>/eventTriggers/

Update
PUT https://api.blockbax.com/v1/projects/<PROJECT_ID>/eventTriggers/<EVENT_TRIGGER_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
event_trigger_id="08efb2ce-18d2-4aa1-9f8c-f745386ad1ac"

curl -X POST "https://api.blockbax.com/v1/projects/${project_id}/eventTriggers/"
or
curl -X PUT "https://api.blockbax.com/v1/projects/${project_id}/eventTriggers/${event_trigger_id}"
  -H "Authorization: ApiKey ${api_key}"
  -d '{
        "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
        "metricIds": ["7c40cc50-aa51-4eb2-8937-71ce62798f17"],
        "name": "Temperature",
        "archived": false,
        "eventRules": [
          {
            "valueType": "MEASUREMENT_VALUE",
            "operator": "EQUALS",
            "value": 20,
            "eventLevel": "PROBLEM"
          },
          {
            "valueType": "MEASUREMENT_VALUE",
            "operator": "GREATER_THAN",
            "value": 22,
            "eventLevel": "WARNING",
            "durationConstraint": {
              "periodValue": 30,
              "periodUnit": "MINUTES"
            },
            "occurrencesConstraint": {
              "occurrences": 10,
              "periodValue": 1,
              "periodUnit": "HOURS"
            },
            "timeConstraint": {
              "startTime": "08:00",
              "endTime": "17:00"
            }
          },
          {
            "valueType": "MEASUREMENT_VALUE",
            "operator": "LESS_THAN_OR_EQUALS",
            "value": 18,
            "eventLevel": "INFORMATION"
          }
        ]
      }'

Example response

{
  "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
  "metricIds": ["7c40cc50-aa51-4eb2-8937-71ce62798f17"],
  "name": "Temperature",
  "version": 2,
  "archived": false,
  "latestVersion": true,
  "eventRules": [
    {
      "valueType": "MEASUREMENT_VALUE",
      "operator": "EQUALS",
      "value": 20,
      "eventLevel": "PROBLEM"
    },
    {
      "valueType": "MEASUREMENT_VALUE",
      "operator": "GREATER_THAN",
      "value": 22,
      "eventLevel": "WARNING",
      "durationConstraint": {
        "periodValue": 30,
        "periodUnit": "MINUTES"
      },
      "occurrencesConstraint": {
        "occurrences": 10,
        "periodValue": 1,
        "periodUnit": "HOURS"
      },
      "timeConstraint": {
        "startTime": "08:00",
        "endTime": "17:00"
      }
    },
    {
      "valueType": "MEASUREMENT_VALUE",
      "operator": "LESS_THAN_OR_EQUALS",
      "value": 18,
      "eventLevel": "INFORMATION"
    }
  ]
}

Body

Delete an event trigger

Delete an existing event trigger.

HTTP Request

DELETE https://api.blockbax.com/v1/projects/<PROJECT_ID>/eventTriggers/<EVENT_TRIGGER_ID>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
event_trigger_id="08efb2ce-18d2-4aa1-9f8c-f745386ad1ac"

curl -X DELETE "https://api.blockbax.com/v1/projects/${project_id}/eventTriggers/${event_trigger_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{}

Parameters

This endpoint takes no arguments.

Measurements

This endpoint allows you to programmatically send and query measurements.

Search measurements

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/measurements?subjectId=<SUBJECT_ID>&metricId=<METRIC_ID>&fromDate=<FROM_DATE>&toDate=<TO_DATE>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
subject_id="f59ee376-ccec-40e1-8ebe-38bef7a30ac9"
metric_id="7c40cc50-aa51-4eb2-8937-71ce62798f17"
from_date="2019-04-02T00%3A00%3A00.000%2B0200"
to_date="2019-04-03T00%3A00%3A00.000%2B0200"

curl "https://api.blockbax.com/v1/projects/${project_id}/measurements?subjectId=${subject_id}&metricId=${metric_id}&fromDate=${from_date}&toDate=${to_date}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "measurements": [
    {
      "date": "2019-04-02T15:00:01.946+0000",
      "value": 22.1
    },
    {
      "date": "2019-04-02T15:05:02.124+0000",
      "value": 23.8
    }
  ]
}

Fetch existing measurements.

Parameters

Send measurements

HTTP Request

POST https://api.blockbax.com/v1/projects/<PROJECT_ID>/measurements

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"

curl "https://api.blockbax.com/v1/projects/${project_id}/measurements"
  -H "Authorization: ApiKey ${api_key}"
  -H "Content-Type: application/json"
  -d '{
        "series":[
          {
            "ingestionId": "MyHouse$LivingRoomTemperature",
            "measurements": [
              {
                "date": "2019-04-09T12:00:00.000+00:00",
                "value": 10.3
              },
              {
                "date": "2019-04-09T12:01:00.000+00:00",
                "value": 11.5
              }
            ]
          }
        ]
      }'

Example response

{}

Send new measurements.

Body

Events

This endpoint allows you to programmatically query events.

Search events

HTTP Request

GET "https://api.blockbax.com/v1/projects/<PROJECT_ID>/events

Example Request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"

curl "https://api.blockbax.com/v1/projects/${project_id}/events?fromDate=2019-04-03T13:00:00.000Z&toDate=2019-04-10T13:00:00.000Z&subjectIds=<SUBJECT_IDS>&metricIds=<METRIC_IDS>&eventTriggerIds=<EVENT_TRIGGER_IDS>&eventLevels=problem,warning&page=0&size=20&sort=date,desc"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "count": 2,
  "result": [
    {
      "id": "bdc74b43-8e94-40c7-bfcb-6b9b435f0af8",
      "eventTriggerId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "version": 8,
      "eventLevel": "WARNING",
      "subjectId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
      "metricId": "7c40cc50-aa51-4eb2-8937-71ce62798f17",
      "date": "2019-04-10T12:03:00.000+0000"
    },
    {
      "id": "eeaa6dcc-eb63-4068-af68-4b651c5ef8dd",
      "eventTriggerId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "version": 8,
      "eventLevel": "OK",
      "subjectId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
      "metricId": "7c40cc50-aa51-4eb2-8937-71ce62798f17",
      "date": "2019-04-10T07:15:21.005+0000",
      "endDate": "2019-04-10T11:28:11.460+0000"
    }
  ]
}

Search and filter events. Results are paginated with a maximum of 100 results at a time.

Parameters

Get an event

HTTP Request

GET "https://api.blockbax.com/v1/projects/<PROJECT_ID>/events/<EVENT_ID>

Example Request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
event_id="eeaa6dcc-eb63-4068-af68-4b651c5ef8dd"

curl "https://api.blockbax.com/v1/projects/${project_id}/events/${event_id}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "id": "eeaa6dcc-eb63-4068-af68-4b651c5ef8dd",
  "eventTriggerId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "version": 8,
  "eventLevel": "OK",
  "subjectId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
  "metricId": "7c40cc50-aa51-4eb2-8937-71ce62798f17",
  "date": "2019-04-10T07:15:21.005+0000",
  "endDate": "2019-04-10T11:28:11.460+0000"
}

Fetch an existing event.

Parameters

This endpoint takes no arguments.