API Navigation

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>

Make sure to replace <API_key> with your API key, for instance in the cURL examples throughout the API reference.

Rate limits

Blockbax uses rate limits to avoid resource starvation. All endpoints are rate limited except the endpoint for sending measurements. Once a rate limit is hit a 429 response code is returned for all subsequent requests until the limit is reset.

Rate limits can be inspected by looking at the content of the related response headers:

Header Description
X-RateLimit-Limit Number of requests allowed in a specific time period
X-RateLimit-Remaining Number of requests remaining in the current time period
X-RateLimit-Reset Number of seconds remaining in the current time period until rate limit is reset

If you are rate limited you can throttle your requests by waiting the time returned in the X-RateLimit-Reset header before retrying and making other requests again.

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",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "name": "My Project",
  "description": "This is my project",
  "timezoneId": "Europe/Amsterdam",
  "organizationId": "86d9e586-70b7-4f6b-a5af-9cb5c48de661"
}

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": 2,
  "result": [
    {
      "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "createdDate": "2021-01-24T15:00:01.946+0000",
      "updatedDate": "2021-01-24T15:05:02.124+0000",
      "name": "City",
      "externalId": "city",
      "dataType": "TEXT",
      "predefinedValues": true,
      "values": [
        {
          "id": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
          "text": "Amsterdam"
        },
        {
          "id": "6121933f-6f90-448e-86d2-ced335ac9172",
          "text": "Rotterdam"
        }
      ]
    },
    {
      "id": "4126798f-398a-4b90-92e0-4a03fc286bcf",
      "createdDate": "2021-01-24T15:00:01.946+0000",
      "updatedDate": "2021-01-24T15:05:02.124+0000",
      "name": "Capacity (persons)",
      "externalId": "capacity",
      "dataType": "NUMBER",
      "predefinedValues": true,
      "values": [
        {
          "id": "2dcaa9cb-6d39-4997-a710-0f6ccabdb3e3",
          "caption": "ElevatorType1",
          "number": 5
        },
        {
          "id": "a0f72e76-53a0-4d88-b1f6-dc7d9b1e927a",
          "number": 8
        }
      ]
    },
    {
      "id": "ade083a4-fb3a-490a-8025-312112066b79",
      "createdDate": "2021-01-25T15:00:01.946+0000",
      "updatedDate": "2021-01-25T15:05:02.124+0000",
      "name": "Geographic coordinate",
      "externalId": "geographic-coordinate",
      "dataType": "LOCATION",
      "predefinedValues": false,
      "values": [
        {
          "id": "f8c52571-b882-4bf0-b013-f38f9621e7b8",
          "location": {
            "lat": 52.37403, "lon": 4.88969, "alt": -3.2
          }
        },
        {
          "id": "dfff4f32-f2be-480e-8bb1-87d71d74aeb6",
          "location": {
            "lat": 51.9225, "lon": 4.47917, "alt": -5.2
          }
        }
      ]
    },
    {
      "id": "d237162d-6da6-455e-8921-ba0c4bae4fc5",
      "createdDate": "2021-01-25T15:00:01.946+0000",
      "updatedDate": "2021-01-25T15:05:02.124+0000",
      "name": "Factory layout",
      "externalId": "factory-layout",
      "dataType": "MAP_LAYER",
      "predefinedValues": false,
      "values": [
        {
          "id": "8a75002b-0c63-4fe8-afc0-2c05e428a76a",
          "mapLayer": {
            "imagePath" : "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/d237162d-6da6-455e-8921-ba0c4bae4fc5/values/8a75002b-0c63-4fe8-afc0-2c05e428a76a/files/efa6753f-4981-417f-aabd-be0f43c6e4f6.png",
            "leftBottom" : {
              "lat": 52.37403, "lon": 4.88969
            },
            "leftTop" : {
              "lat": 52.37404, "lon": 4.88969
            },
            "rightBottom" : {
              "lat": 52.37403, "lon": 4.88970
            },
            "rightTop" : {
              "lat": 52.37404, "lon": 4.88970
            }
          }
        }
      ]
    },
    {
      "id": "bae083a4-fb3a-490a-8025-312112066b66",
      "createdDate": "2021-01-25T15:00:01.946+0000",
      "updatedDate": "2021-01-25T15:05:02.124+0000",
      "name": "Equipment photos",
      "externalId": "equipment-photos",
      "dataType": "IMAGE",
      "predefinedValues": false,
      "values": [
        {
          "id": "a8c52571-b882-4bf0-b013-f38f9621e7b6",
          "image": {
            "imagePath": "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/bae083a4-fb3a-490a-8025-312112066b66/values/a8c52571-b882-4bf0-b013-f38f9621e7b6/files/ada6753f-4981-417f-aabd-be0f43c6e4c9.png"
          }
        }
      ]
    },
    {
      "id": "dee083a4-fb3a-490a-8025-312112066b11",
      "createdDate": "2021-01-25T15:00:01.946+0000",
      "updatedDate": "2021-01-25T15:05:02.124+0000",
      "name": "Area",
      "externalId": "area",
      "dataType": "AREA",
      "predefinedValues": false,
      "values": [
        {
          "id": "c4c52571-b882-4bf0-b013-f38f9621e7d8",
          "area": {
            "polygon": {
              "outerRing": [
                {
                  "lat": 52.37404, "lon": 4.88969
                },
                {
                  "lat": 51.37404, "lon": 3.88969
                },
                {
                  "lat": 52.37404, "lon": 2.88969
                },
                {
                  "lat": 52.37404, "lon": 4.88969
                }
              ]
            }
          }
        }
      ]
    }
  ]
}

Search and filter property types. Results are paginated with a maximum of 200 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",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "name": "City",
  "externalId": "city",
  "dataType": "TEXT",
  "predefinedValues": true,
  "values": [
    {
      "id": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
      "caption": "The city in the Netherlands",
      "text": "Amsterdam"
    },
    {
      "id": "6121933f-6f90-448e-86d2-ced335ac9172",
      "text": "Rotterdam"
    }
  ]
}

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}"
  -H "Content-Type: application/json"
  -d '{
        "name": "City",
        "externalId": "city",
        "dataType": "TEXT",
        "predefinedValues": true,
        "values": [
          {
            "id": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
            "caption": "The city in the Netherlands",
            "text": "Amsterdam"
          },
          {
            "text": "Den Haag"
          }
        ]
      }'

Example response

{
  "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "name": "City",
  "externalId": "city",
  "dataType": "TEXT",
  "predefinedValues": true,
  "values": [
    {
      "id": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
      "caption": "The city in the Netherlands",
      "text": "Amsterdam"
    },
    {
      "id": "6121933f-6f90-448e-86d2-ced335ac9172",
      "text": "Den Haag"
    }
  ]
}

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",
      "createdDate": "2021-01-24T15:00:01.946+0000",
      "updatedDate": "2021-01-24T15:05:02.124+0000",
      "parentSubjectTypeIds": ["5674b063-7be9-465e-a8d8-451170960acb"],
      "name": "Transformer substation",
      "primaryLocation": {
        "type": "PROPERTY_TYPE",
        "id": "50f381bf-eb46-4d73-9bfd-5bfb57db43d6"
      },
      "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 200 results at a time.

Parameters

Note

At the moment the deprecated field parentSubjectTypeId is included in the response for backward compatibility, if and only if there is only one parent subject type. Please do not use this field, it will be removed in the near future.

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",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "parentSubjectTypeIds": ["5674b063-7be9-465e-a8d8-451170960acb"],
  "name": "Transformer substation",
  "primaryLocation": {
    "type": "PROPERTY_TYPE",
    "id": "50f381bf-eb46-4d73-9bfd-5bfb57db43d6"
  },
  "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.

Note

At the moment the deprecated field parentSubjectTypeId is included in the response for backward compatibility, if and only if there is only one parent subject type. Please do not use this field, it will be removed in the near future.

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}"
  -H "Content-Type: application/json"
  -d '{
        "parentSubjectTypeIds": ["5674b063-7be9-465e-a8d8-451170960acb"],
        "name": "Transformer substation",
        "primaryLocation" : {
          "type" : "PROPERTY_TYPE",
          "id" : "50f381bf-eb46-4d73-9bfd-5bfb57db43d6"
        },
        "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",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "parentSubjectTypeIds": ["5674b063-7be9-465e-a8d8-451170960acb"],
  "name": "Transformer substation",
  "primaryLocation": {
    "type": "PROPERTY_TYPE",
    "id": "50f381bf-eb46-4d73-9bfd-5bfb57db43d6"
  },
  "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",
      "createdDate": "2021-01-24T15:00:01.946+0000",
      "updatedDate": "2021-01-24T15:05:02.124+0000",
      "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "parentSubjectId": "e2bbf958-9f60-4e67-97df-3f6e2c1c08a0",
      "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$MyTemperature"
        }
      ],
      "properties": [
        {
          "typeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
          "valueId": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
          "text": "Rotterdam"
        },
        {
          "typeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
          "valueId": "2dcaa9cb-6d39-4997-a710-0f6ccabdb3e3",
          "caption": "Enum value five",
          "number": 5
        },
        {
          "typeId": "ade083a4-fb3a-490a-8025-312112066b79",
          "valueId": "f8c52571-b882-4bf0-b013-f38f9621e7b8",
          "location": {
            "lat": 52.37403, "lon": 4.88969, "alt": -3.2
          }
        },
        {
          "typeId": "d237162d-6da6-455e-8921-ba0c4bae4fc5",
          "valueId": "8a75002b-0c63-4fe8-afc0-2c05e428a76a",
          "mapLayer": {
            "imagePath" : "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/d237162d-6da6-455e-8921-ba0c4bae4fc5/values/8a75002b-0c63-4fe8-afc0-2c05e428a76a/files/efa6753f-4981-417f-aabd-be0f43c6e4f6.png",
            "leftBottom" : {
              "lat": 52.37403, "lon": 4.88969
            },
            "leftTop" : {
              "lat": 52.37404, "lon": 4.88969
            },
            "rightBottom" : {
              "lat": 52.37403, "lon": 4.88970
            },
            "rightTop" : {
              "lat": 52.37404, "lon": 4.88970
            }
          }
        },
        {
          "typeId": "bae083a4-fb3a-490a-8025-312112066b66",
          "valueId": "a8c52571-b882-4bf0-b013-f38f9621e7b6",
          "image": {
            "imagePath": "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/bae083a4-fb3a-490a-8025-312112066b66/values/a8c52571-b882-4bf0-b013-f38f9621e7b6/files/ada6753f-4981-417f-aabd-be0f43c6e4c9.png"
          }
        },
        {
          "typeId": "dee083a4-fb3a-490a-8025-312112066b11",
          "valueId": "c4c52571-b882-4bf0-b013-f38f9621e7d8",
          "area": {
            "polygon": {
              "outerRing": [
                {
                  "lat": 52.37404, "lon": 4.88969
                },
                {
                  "lat": 51.37404, "lon": 3.88969
                },
                {
                  "lat": 52.37404, "lon": 2.88969
                },
                {
                  "lat": 52.37404, "lon": 4.88969
                }
              ]
            }
          }
        },
        {
          "typeId": "fc13e380-aee1-46c3-a125-2a7831b6d492",
          "valueId": "dc93a95c-7bc4-4e91-a36c-97f17ba0c9ef",
          "inherit": true,
          "text": "I inherited this value from my parent subject"
        }
      ]
    },
    {
      "id": "e889593b-d07d-4c53-a83f-3458e8e04a98",
      "createdDate": "2021-01-24T15:00:01.946+0000",
      "updatedDate": "2021-01-24T15:05:02.124+0000",
      "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "parentSubjectId": "e2bbf958-9f60-4e67-97df-3f6e2c1c08a0",
      "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": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
          "valueId": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
          "text": "Amsterdam"
        },
        {
          "typeId": "ade083a4-fb3a-490a-8025-312112066b79",
          "valueId": "dfff4f32-f2be-480e-8bb1-87d71d74aeb6",
          "location": {
            "lat": 51.9225, "lon": 4.47917, "alt": -5.2
          }
        }
      ]
    }
  ]
}

Search and filter subjects. Results are paginated with a maximum of 200 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",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "parentSubjectId": "e2bbf958-9f60-4e67-97df-3f6e2c1c08a0",
  "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$MyTemperature"
    }
  ],
  "properties": [
    {
      "typeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "valueId": "4204fbd0-d09b-4803-adc5-09dbbc448d30",
      "text": "Rotterdam"
    },
    {
      "typeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "valueId": "2dcaa9cb-6d39-4997-a710-0f6ccabdb3e3",
      "caption": "Enum value five",
      "number": 5
    },
    {
      "typeId": "ade083a4-fb3a-490a-8025-312112066b79",
      "valueId": "f8c52571-b882-4bf0-b013-f38f9621e7b8",
      "location": {
        "lat": 52.37403, "lon": 4.88969, "alt": -3.2
      }
    },
    {
      "typeId": "d237162d-6da6-455e-8921-ba0c4bae4fc5",
      "valueId": "8a75002b-0c63-4fe8-afc0-2c05e428a76a",
      "mapLayer": {
        "imagePath" : "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/d237162d-6da6-455e-8921-ba0c4bae4fc5/values/8a75002b-0c63-4fe8-afc0-2c05e428a76a/files/efa6753f-4981-417f-aabd-be0f43c6e4f6.png",
        "leftBottom" : {
          "lat": 52.37403, "lon": 4.88969
        },
        "leftTop" : {
          "lat": 52.37404, "lon": 4.88969
        },
        "rightBottom" : {
          "lat": 52.37403, "lon": 4.88970
        },
        "rightTop" : {
          "lat": 52.37404, "lon": 4.88970
        }
      }
    },
    {
      "typeId": "bae083a4-fb3a-490a-8025-312112066b66",
      "valueId": "a8c52571-b882-4bf0-b013-f38f9621e7b6",
      "image": {
        "imagePath": "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/bae083a4-fb3a-490a-8025-312112066b66/values/a8c52571-b882-4bf0-b013-f38f9621e7b6/files/ada6753f-4981-417f-aabd-be0f43c6e4c9.png"
      }
    },
    {
      "typeId": "dee083a4-fb3a-490a-8025-312112066b11",
      "valueId": "c4c52571-b882-4bf0-b013-f38f9621e7d8",
      "area": {
        "polygon": {
          "outerRing": [
            {
              "lat": 52.37404, "lon": 4.88969
            },
            {
              "lat": 51.37404, "lon": 3.88969
            },
            {
              "lat": 52.37404, "lon": 2.88969
            },
            {
              "lat": 52.37404, "lon": 4.88969
            }
          ]
        }
      }
    },
    {
      "typeId": "fc13e380-aee1-46c3-a125-2a7831b6d492",
      "valueId": "dc93a95c-7bc4-4e91-a36c-97f17ba0c9ef",
      "inherit": true,
      "text": "I inherited this value from my parent subject"
    }
  ]
}

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}"
  -H "Content-Type: application/json"
  -d '{
        "name": "My house",
        "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
        "parentSubjectId": "e2bbf958-9f60-4e67-97df-3f6e2c1c08a0",
        "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",
            "text": "MyValue"
          },
          {
            "typeId": "34a50cb8-517c-43fb-9397-b0159e5c692e",
            "valueId" : "861d2845-e90a-473b-954f-19965277fce4"
          },
          {
            "typeId": "34a50cb8-517c-43fb-9397-b0159e5c692e",
            "location": {
              "lat": 30.2, "lon": 20.25, "alt": 0.25
            }
          },
          {
            "typeId": "d237162d-6da6-455e-8921-ba0c4bae4fc5",
            "mapLayer": {
              "imagePath" : "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/d237162d-6da6-455e-8921-ba0c4bae4fc5/values/8a75002b-0c63-4fe8-afc0-2c05e428a76a/files/efa6753f-4981-417f-aabd-be0f43c6e4f6.png",
              "leftBottom" : {
                "lat": 52.37403, "lon": 4.88969
              },
              "leftTop" : {
                "lat": 52.37404, "lon": 4.88969
              },
              "rightBottom" : {
                "lat": 52.37403, "lon": 4.88970
              },
              "rightTop" : {
                "lat": 52.37404, "lon": 4.88970
              }
            }
          },
          {
            "typeId": "bae083a4-fb3a-490a-8025-312112066b66",
            "image": {
              "imagePath": "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/bae083a4-fb3a-490a-8025-312112066b66/values/a8c52571-b882-4bf0-b013-f38f9621e7b6/files/ada6753f-4981-417f-aabd-be0f43c6e4c9.png"
            }
          },
          {
            "typeId": "fc13e380-aee1-46c3-a125-2a7831b6d492",
            "inherit": true
          }
        ]
      }'

Example response

{
  "id": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "parentSubjectId": "e2bbf958-9f60-4e67-97df-3f6e2c1c08a0",
  "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",
      "text": "MyValue"
    },
    {
      "typeId": "34a50cb8-517c-43fb-9397-b0159e5c692e",
      "valueId": "861d2845-e90a-473b-954f-19965277fce4",
      "location": {
        "lat": 30.2, "lon": 20.25, "alt": 0.25
      }
    },
    {
      "typeId": "d237162d-6da6-455e-8921-ba0c4bae4fc5",
      "valueId": "8a75002b-0c63-4fe8-afc0-2c05e428a76a",
      "mapLayer": {
        "imagePath" : "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/d237162d-6da6-455e-8921-ba0c4bae4fc5/values/8a75002b-0c63-4fe8-afc0-2c05e428a76a/files/efa6753f-4981-417f-aabd-be0f43c6e4f6.png",
        "leftBottom" : {
          "lat": 52.37403, "lon": 4.88969
        },
        "leftTop" : {
          "lat": 52.37404, "lon": 4.88969
        },
        "rightBottom" : {
          "lat": 52.37403, "lon": 4.88970
        },
        "rightTop" : {
          "lat": 52.37404, "lon": 4.88970
        }
      }
    },
    {
      "typeId": "bae083a4-fb3a-490a-8025-312112066b66",
      "valueId": "a8c52571-b882-4bf0-b013-f38f9621e7b6",
      "image": {
        "imagePath": "/projects/715b6935-e3d8-48b1-86a3-a6e2a268e1f/propertyTypes/bae083a4-fb3a-490a-8025-312112066b66/values/a8c52571-b882-4bf0-b013-f38f9621e7b6/files/ada6753f-4981-417f-aabd-be0f43c6e4c9.png"
      }
    },
    {
      "typeId": "fc13e380-aee1-46c3-a125-2a7831b6d492",
      "valueId": "dc93a95c-7bc4-4e91-a36c-97f17ba0c9ef",
      "inherit": true,
      "text": "I inherited this value from my parent subject"
    }
  ]
}

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/<SUBJECT_ID>

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",
      "createdDate": "2021-01-24T15:00:01.946+0000",
      "updatedDate": "2021-01-24T15:05:02.124+0000",
      "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "name": "Temperature living room",
      "dataType": "NUMBER",
      "unit": "°C",
      "precision": 2,
      "visible": true,
      "type": "INGESTED",
      "discrete": false,
      "preferredColor": "#2fc177",
      "externalId": "LivingRoomTemperature",
      "mappingLevel": "OWN"
    },
    {
      "id": "7f43ba7b-2c80-4e4f-b2b6-4f7fecd03116",
      "createdDate": "2021-01-24T15:00:01.946+0000",
      "updatedDate": "2021-01-24T15:05:02.124+0000",
      "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "name": "Humidity living room",
      "dataType": "NUMBER",
      "unit": "%",
      "precision": 2,
      "visible": true,
      "type": "INGESTED",
      "discrete": false,
      "preferredColor": "#2fc177",
      "externalId": "LivingRoomHumidity",
      "mappingLevel": "CHILD"
    }
  ]
}

Search and filter metrics. Results are paginated with a maximum of 200 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",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "name": "Temperature living room",
  "dataType": "NUMBER",
  "unit": "°C",
  "precision": 2,
  "visible": true,
  "type": "INGESTED",
  "discrete": false,
  "preferredColor": "#2fc177",
  "externalId": "LivingRoomTemperature",
  "mappingLevel": "OWN"
}

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}"
  -H "Content-Type: application/json"
  -d '{
        "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
        "name": "Temperature living room",
        "dataType": "NUMBER",
        "unit": "°C",
        "precision": 2,
        "visible": true,
        "type": "INGESTED",
        "discrete": false,
        "preferredColor": "#2FC177",
        "externalId": "LivingRoomTemperature",
        "mappingLevel": "OWN"
      }'

Example response

{
  "id": "e2e5a8e4-ac23-4821-8ab7-18f994ec674d",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "name": "Temperature living room",
  "dataType": "NUMBER",
  "unit": "°C",
  "precision": 2,
  "visible": true,
  "subjectTypeId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "type": "INGESTED",
  "discrete": false,
  "preferredColor": "#2fc177",
  "externalId": "LivingRoomTemperature",
  "mappingLevel": "OWN"
}

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": "68d64e04-a44d-4ab8-80da-68ad87f976f2",
      "createdDate": "2021-01-12T10:51:19.114+00:00",
      "subjectTypeId": "50ebe3b6-c2e9-45d0-9540-f7a920571148",
      "name": "Event trigger with various condition examples",
      "version": 1,
      "archived": false,
      "latestVersion": true,
      "active": true,
      "evaluationTrigger": "SUBJECT_METRICS",
      "evaluationConstraint": "ALL_TIMESTAMPS_MATCH",
      "eventRules": [
        {
          "eventLevel": "PROBLEM",
          "conditionSets": [
            {
              "description": "threshold with times",
              "id": "7c2d3848-58fa-4f5d-989c-557d03469cda",
              "inputConditions": [
                {
                  "type": "THRESHOLD",
                  "leftOperand": {
                    "type": "METRIC",
                    "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc",
                    "aggregation": {
                      "function": "AVG",
                      "period": {
                        "unit": "SECOND",
                        "amount": 2
                      }
                    }
                  },
                  "comparisonOperator": "GREATER_THAN",
                  "rightOperand": {
                    "type": "STATIC_VALUE",
                    "number": 10.5
                  }
                }
              ],
              "durationCondition": {
                "period": {
                  "unit": "MILLISECOND",
                  "amount": 1500
                }
              },
              "occurrenceCondition": {
                "occurrences": 42,
                "period": {
                  "unit": "MINUTE",
                  "amount": 2
                }
              },
              "dayTimeCondition": {
                "TUESDAY": [
                  {
                    "fromTime": "06:00",
                    "toTime": "23:00"
                  }
                ],
                "MONDAY": [
                  {
                    "fromTime": "10:00",
                    "toTime": "12:00"
                  },
                  {
                    "fromTime": "13:30",
                    "toTime": "16:45"
                  }
                ]
              }
            },
            {
              "description": "metric 2 less than",
              "id": "8fab9ba3-82c2-4f0d-8f96-9f84896e77dd",
              "inputConditions": [
                {
                  "type": "THRESHOLD",
                  "leftOperand": {
                    "type": "METRIC",
                    "id": "d2f3fb22-75e1-4506-9c6b-80c6f4357f39"
                  },
                  "comparisonOperator": "LESS_THAN",
                  "rightOperand": {
                    "type": "STATIC_VALUE",
                    "number": 15
                  }
                }
              ]
            },
            {
              "description": "metric 3 contains",
              "id": "1fab9ba3-82c2-4f0d-8f96-9f84896e77de",
              "inputConditions": [
                {
                  "type": "TEXT_MATCH",
                  "leftOperand": {
                    "type": "METRIC",
                    "id": "a2f3fb22-75e1-4506-9c6b-80c6f4357f33"
                  },
                  "comparisonOperator": "CONTAINS",
                  "rightOperand": {
                    "type": "STATIC_VALUE",
                    "text": "alarmStatus10"
                  }
                }
              ]
            },
            {
              "description": "metric 4 distance to property type less than static value",
              "id": "a79012a7-d691-49ad-9a2b-178b6113db94",
              "inputConditions": [
                {
                  "type": "THRESHOLD",
                  "leftOperand": {
                    "type": "CALCULATION",
                    "leftOperand": {
                      "leftOperand": {
                        "type": "METRIC",
                        "id": "e96b26f1-11a1-4dc2-b9f1-b513a17b27bc"
                      },
                      "arithmeticOperator": "DISTANCE",
                      "rightOperand": {
                        "type": "PROPERTY_TYPE",
                        "id": "19fb1502-d46a-4681-8930-376c51c9e4c5"
                      }
                    }
                  },
                  "comparisonOperator": "LESS_THAN",
                  "rightOperand": {
                    "type": "STATIC_VALUE",
                    "number": 100
                  }
                }
              ]
            },
            {
              "description": "metric 5 location in property type area",
              "id": "a79012a7-d691-49ad-9a2b-178b6113db94",
              "inputConditions": [
                {
                  "type": "GEOFENCE",
                  "leftOperand": {
                    "type": "PROPERTY_TYPE",
                    "id": "4b4e9376-c534-4846-bac2-f4b4ea6aa82f"
                  },
                  "arithmeticOperator": "CONTAINS",
                  "rightOperand": {
                    "type": "METRIC",
                    "id": "3816ff23-70f8-479c-a5e7-4bb77a2a5320"
                  }
                }
              ]
            }
          ]
        },
        {
          "eventLevel": "WARNING",
          "conditionSets": [
            {
              "description": "change condition and mixed condition",
              "id": "b7c667de-3fb6-47d3-88ee-0bfbb7d7756a",
              "inputConditions": [
                {
                  "type": "THRESHOLD",
                  "leftOperand": {
                    "type": "STATIC_VALUE",
                    "number": 10.6
                  },
                  "comparisonOperator": "EQUALS",
                  "rightOperand": {
                    "type": "PROPERTY_TYPE",
                    "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
                  }
                },
                {
                  "leftOperand": {
                    "type": "VALUE_CHANGE",
                    "arithmeticOperator": "DIFFERENCE",
                    "leftOperand": {
                      "type": "METRIC",
                      "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc"
                    },
                    "rightOperand": {
                      "type": "METRIC",
                      "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc",
                      "offset": {
                        "type" : "PREVIOUS_VALUE"
                      }
                    }
                  },
                  "comparisonOperator": "EQUALS",
                  "rightOperand": {
                    "type": "PROPERTY_TYPE",
                    "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
                  }
                }
              ]
            }
          ]
        },
        {
          "eventLevel": "INFORMATION",
          "conditionSets": [
            {
              "description": "calculation",
              "id": "c7042dd3-7396-4626-9ada-2f39a5e173d7",
              "inputConditions": [
                {
                  "type": "THRESHOLD",
                  "leftOperand": {
                    "type": "CALCULATION",
                    "arithmeticOperator": "DIVISION",
                    "leftOperand": {
                      "type": "METRIC",
                      "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc"
                    },
                    "rightOperand": {
                      "type": "STATIC_VALUE",
                      "number": 99.5
                    }
                  },
                  "comparisonOperator": "LESS_THAN_OR_EQUALS",
                  "rightOperand": {
                    "type": "PROPERTY_TYPE",
                    "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
                  }
                }
              ]
            }
          ]
        }
      ],
      "subjectFilter": {
        "include": {
          "subjectIds": [
            "9eb8319b-f474-4eda-9de3-4169ddf9c607",
            "125b8167-eb00-4402-8fea-7406d4b5b295"
          ],
          "propertyValues": null
        },
        "exclude": null
      }
    }
  ]
}

Search and filter event triggers. Results are paginated with a maximum of 200 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="68d64e04-a44d-4ab8-80da-68ad87f976f2"

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

Example response

{
  "id": "68d64e04-a44d-4ab8-80da-68ad87f976f2",
  "createdDate": "2021-01-12T10:51:19.114+00:00",
  "subjectTypeId": "50ebe3b6-c2e9-45d0-9540-f7a920571148",
  "name": "Event trigger with various condition examples",
  "version": 1,
  "archived": false,
  "latestVersion": true,
  "active": true,
  "evaluationTrigger": "SUBJECT_METRICS",
  "evaluationConstraint": "ALL_TIMESTAMPS_MATCH",
  "eventRules": [
    {
      "eventLevel": "PROBLEM",
      "conditionSets": [
        {
          "description": "threshold with times",
          "id": "7c2d3848-58fa-4f5d-989c-557d03469cda",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "METRIC",
                "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc",
                "aggregation": {
                  "function": "AVG",
                  "period": {
                    "unit": "SECOND",
                    "amount": 2
                  }
                }
              },
              "comparisonOperator": "GREATER_THAN",
              "rightOperand": {
                "type": "STATIC_VALUE",
                "number": 10.5
              }
            }
          ],
          "durationCondition": {
            "period": {
              "unit": "MILLISECOND",
              "amount": 1500
            }
          },
          "occurrenceCondition": {
            "occurrences": 42,
            "period": {
              "unit": "MINUTE",
              "amount": 2
            }
          },
          "dayTimeCondition": {
            "TUESDAY": [
              {
                "fromTime": "06:00",
                "toTime": "23:00"
              }
            ],
            "MONDAY": [
              {
                "fromTime": "10:00",
                "toTime": "12:00"
              },
              {
                "fromTime": "13:30",
                "toTime": "16:45"
              }
            ]
          }
        },
        {
          "description": "metric 2 less than",
          "id": "8fab9ba3-82c2-4f0d-8f96-9f84896e77dd",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "METRIC",
                "id": "d2f3fb22-75e1-4506-9c6b-80c6f4357f39",
                "aggregation": {
                  "function": "AVG",
                  "period": {
                    "unit": "SECOND",
                    "amount": 2
                  }
                }
              },
              "comparisonOperator": "LESS_THAN",
              "rightOperand": {
                "type": "STATIC_VALUE",
                "number": 15
              }
            }
          ]
        },
        {
          "description": "metric 3 contains",
          "id": "1fab9ba3-82c2-4f0d-8f96-9f84896e77de",
          "inputConditions": [
            {
              "type": "TEXT_MATCH",
              "leftOperand": {
                "type": "METRIC",
                "id": "a2f3fb22-75e1-4506-9c6b-80c6f4357f33"
              },
              "comparisonOperator": "CONTAINS",
              "rightOperand": {
                "type": "STATIC_VALUE",
                "text": "alarmStatus10"
              }
            }
          ]
        },
        {
          "description": "metric 4 distance to property type less than static value",
          "id": "a79012a7-d691-49ad-9a2b-178b6113db94",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "CALCULATION",
                "leftOperand": {
                  "leftOperand": {
                    "type": "METRIC",
                    "id": "e96b26f1-11a1-4dc2-b9f1-b513a17b27bc"
                  },
                  "arithmeticOperator": "DISTANCE",
                  "rightOperand": {
                    "type": "PROPERTY_TYPE",
                    "id": "19fb1502-d46a-4681-8930-376c51c9e4c5"
                  }
                }
              },
              "comparisonOperator": "LESS_THAN",
              "rightOperand": {
                "type": "STATIC_VALUE",
                "number": 100
              }
            }
          ]
        },
        {
          "description": "metric 5 location in property type area",
          "id": "a79012a7-d691-49ad-9a2b-178b6113db94",
          "inputConditions": [
            {
              "type": "GEOFENCE",
              "leftOperand": {
                "type": "PROPERTY_TYPE",
                "id": "4b4e9376-c534-4846-bac2-f4b4ea6aa82f"
              },
              "arithmeticOperator": "CONTAINS",
              "rightOperand": {
                "type": "METRIC",
                "id": "3816ff23-70f8-479c-a5e7-4bb77a2a5320"
              }
            }
          ]
        }
      ]
    },
    {
      "eventLevel": "WARNING",
      "conditionSets": [
        {
          "description": "change condition and mixed condition",
          "id": "b7c667de-3fb6-47d3-88ee-0bfbb7d7756a",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "STATIC_VALUE",
                "number": 10.6
              },
              "comparisonOperator": "EQUALS",
              "rightOperand": {
                "type": "PROPERTY_TYPE",
                "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
              }
            },
            {
              "leftOperand": {
                "type": "VALUE_CHANGE",
                "arithmeticOperator": "DIFFERENCE",
                "leftOperand": {
                  "type": "METRIC",
                  "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc"
                },
                "rightOperand": {
                  "type": "METRIC",
                  "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc",
                  "offset": {
                    "type" : "PREVIOUS_VALUE"
                  }
                }
              },
              "comparisonOperator": "EQUALS",
              "rightOperand": {
                "type": "PROPERTY_TYPE",
                "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
              }
            }
          ]
        }
      ]
    },
    {
      "eventLevel": "INFORMATION",
      "conditionSets": [
        {
          "description": "calculation",
          "id": "c7042dd3-7396-4626-9ada-2f39a5e173d7",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "CALCULATION",
                "arithmeticOperator": "DIVISION",
                "leftOperand": {
                  "type": "METRIC",
                  "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc"
                },
                "rightOperand": {
                  "type": "STATIC_VALUE",
                  "number": 99.5
                }
              },
              "comparisonOperator": "LESS_THAN_OR_EQUALS",
              "rightOperand": {
                "type": "PROPERTY_TYPE",
                "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
              }
            }
          ]
        }
      ]
    }
  ],
  "subjectFilter": {
    "include": {
      "subjectIds": [
        "9eb8319b-f474-4eda-9de3-4169ddf9c607",
        "125b8167-eb00-4402-8fea-7406d4b5b295"
      ],
      "propertyValues": null
    },
    "exclude": null
  }
}

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}"
  -H "Content-Type: application/json"
  -d '{
        "subjectTypeId": "50ebe3b6-c2e9-45d0-9540-f7a920571148",
        "name": "Event trigger with various condition examples",
        "archived": false,
        "active": true,
        "evaluationTrigger": "SUBJECT_METRICS",
        "evaluationConstraint": "ALL_TIMESTAMPS_MATCH",
        "eventRules": [
          {
            "eventLevel": "PROBLEM",
            "conditionSets": [
              {
                "description": "threshold with times",
                "inputConditions": [
                  {
                    "type": "THRESHOLD",
                    "leftOperand": {
                      "type": "METRIC",
                      "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc",
                      "aggregation": {
                        "function": "AVG",
                        "period": {
                          "unit": "SECOND",
                          "amount": 2
                        }
                      }
                    },
                    "comparisonOperator": "GREATER_THAN",
                    "rightOperand": {
                      "type": "STATIC_VALUE",
                      "number": 10.5
                    }
                  }
                ],
                "durationCondition": {
                  "period": {
                    "unit": "MILLISECOND",
                    "amount": 1500
                  }
                },
                "occurrenceCondition": {
                  "occurrences": 42,
                  "period": {
                    "unit": "MINUTE",
                    "amount": 2
                  }
                },
                "dayTimeCondition": {
                  "TUESDAY": [
                    {
                      "fromTime": "06:00",
                      "toTime": "23:00"
                    }
                  ],
                  "MONDAY": [
                    {
                      "fromTime": "10:00",
                      "toTime": "12:00"
                    },
                    {
                      "fromTime": "13:30",
                      "toTime": "16:45"
                    }
                  ]
                }
              },
              {
                "description": "metric 2 less than",
                "inputConditions": [
                  {
                    "type": "THRESHOLD",
                    "leftOperand": {
                      "type": "METRIC",
                      "id": "d2f3fb22-75e1-4506-9c6b-80c6f4357f39"
                    },
                    "comparisonOperator": "LESS_THAN",
                    "rightOperand": {
                      "type": "STATIC_VALUE",
                      "number": 15
                    }
                  }
                ]
              },
              {
                "description": "metric 3 contains",
                "inputConditions": [
                  {
                    "type": "TEXT_MATCH",
                    "leftOperand": {
                      "type": "METRIC",
                      "id": "a2f3fb22-75e1-4506-9c6b-80c6f4357f33"
                    },
                    "comparisonOperator": "CONTAINS",
                    "rightOperand": {
                      "type": "STATIC_VALUE",
                      "text": "alarmStatus10"
                    }
                  }
                ]
              },
              {
                "description": "metric 4 distance to property type less than static value",
                "inputConditions": [
                  {
                    "type": "THRESHOLD",
                    "leftOperand": {
                      "type": "CALCULATION",
                      "leftOperand": {
                        "leftOperand": {
                          "type": "METRIC",
                          "id": "e96b26f1-11a1-4dc2-b9f1-b513a17b27bc"
                        },
                        "arithmeticOperator": "DISTANCE",
                        "rightOperand": {
                          "type": "PROPERTY_TYPE",
                          "id": "19fb1502-d46a-4681-8930-376c51c9e4c5"
                        }
                      }
                    },
                    "comparisonOperator": "LESS_THAN",
                    "rightOperand": {
                      "type": "STATIC_VALUE",
                      "number": 100
                    }
                  }
                ]
              },
              {
                "description": "metric 5 location in property type area",
                "inputConditions": [
                  {
                    "type": "GEOFENCE",
                    "leftOperand": {
                      "type": "PROPERTY_TYPE",
                      "id": "4b4e9376-c534-4846-bac2-f4b4ea6aa82f"
                    },
                    "arithmeticOperator": "CONTAINS",
                    "rightOperand": {
                      "type": "METRIC",
                      "id": "3816ff23-70f8-479c-a5e7-4bb77a2a5320"
                    }
                  }
                ]
              }
            ]
          },
          {
            "eventLevel": "WARNING",
            "conditionSets": [
              {
                "description": "change condition and mixed condition",
                "inputConditions": [
                  {
                    "type": "THRESHOLD",
                    "leftOperand": {
                      "type": "STATIC_VALUE",
                      "number": 10.6
                    },
                    "comparisonOperator": "EQUALS",
                    "rightOperand": {
                      "type": "PROPERTY_TYPE",
                      "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
                    }
                  },
                  {
                    "leftOperand": {
                      "type": "VALUE_CHANGE",
                      "arithmeticOperator": "DIFFERENCE",
                      "leftOperand": {
                        "type": "METRIC",
                        "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc"
                      },
                      "rightOperand": {
                        "type": "METRIC",
                        "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc",
                          "offset": {
                            "type" : "PREVIOUS_VALUE"
                        }
                      }
                    },
                    "comparisonOperator": "EQUALS",
                    "rightOperand": {
                      "type": "PROPERTY_TYPE",
                      "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
                    }
                  }
                ]
              }
            ]
          },
          {
            "eventLevel": "INFORMATION",
            "conditionSets": [
              {
                "description": "calculation",
                "inputConditions": [
                  {
                    "type": "THRESHOLD",
                    "leftOperand": {
                      "type": "CALCULATION",
                      "arithmeticOperator": "DIVISION",
                      "leftOperand": {
                        "type": "METRIC",
                        "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc"
                      },
                      "rightOperand": {
                        "type": "STATIC_VALUE",
                        "number": 99.5
                      }
                    },
                    "comparisonOperator": "LESS_THAN_OR_EQUALS",
                    "rightOperand": {
                      "type": "PROPERTY_TYPE",
                      "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
                    }
                  }
                ]
              }
            ]
          }
        ],
        "subjectFilter": {
          "include": {
            "subjectIds": [
              "9eb8319b-f474-4eda-9de3-4169ddf9c607",
              "125b8167-eb00-4402-8fea-7406d4b5b295"
            ],
            "propertyValues": null
          },
          "exclude": null
        }
      }'

Example response

{
  "id": "68d64e04-a44d-4ab8-80da-68ad87f976f2",
  "createdDate": "2021-01-12T10:51:19.114+00:00",
  "subjectTypeId": "50ebe3b6-c2e9-45d0-9540-f7a920571148",
  "name": "Event trigger with various condition examples",
  "version": 1,
  "archived": false,
  "latestVersion": true,
  "active": true,
  "evaluationTrigger": "SUBJECT_METRICS",
  "evaluationConstraint": "ALL_TIMESTAMPS_MATCH",
  "eventRules": [
    {
      "eventLevel": "PROBLEM",
      "conditionSets": [
        {
          "description": "threshold with times",
          "id": "7c2d3848-58fa-4f5d-989c-557d03469cda",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "METRIC",
                "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc",
                "aggregation": {
                  "function": "AVG",
                  "period": {
                    "unit": "SECOND",
                    "amount": 2
                  }
                }
              },
              "comparisonOperator": "GREATER_THAN",
              "rightOperand": {
                "type": "STATIC_VALUE",
                "number": 10.5
              }
            }
          ],
          "durationCondition": {
            "period": {
              "unit": "MILLISECOND",
              "amount": 1500
            }
          },
          "occurrenceCondition": {
            "occurrences": 42,
            "period": {
              "unit": "MINUTE",
              "amount": 2
            }
          },
          "dayTimeCondition": {
            "TUESDAY": [
              {
                "fromTime": "06:00",
                "toTime": "23:00"
              }
            ],
            "MONDAY": [
              {
                "fromTime": "10:00",
                "toTime": "12:00"
              },
              {
                "fromTime": "13:30",
                "toTime": "16:45"
              }
            ]
          }
        },
        {
          "description": "metric 2 less than",
          "id": "8fab9ba3-82c2-4f0d-8f96-9f84896e77dd",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "METRIC",
                "id": "d2f3fb22-75e1-4506-9c6b-80c6f4357f39"
              },
              "comparisonOperator": "LESS_THAN",
              "rightOperand": {
                "type": "STATIC_VALUE",
                "number": 15
              }
            }
          ]
        },
        {
          "description": "metric 3 contains",
          "id": "1fab9ba3-82c2-4f0d-8f96-9f84896e77de",
          "inputConditions": [
            {
              "type": "TEXT_MATCH",
              "leftOperand": {
                "type": "METRIC",
                "id": "a2f3fb22-75e1-4506-9c6b-80c6f4357f33"
              },
              "comparisonOperator": "CONTAINS",
              "rightOperand": {
                "type": "STATIC_VALUE",
                "text": "alarmStatus10"
              }
            }
          ]
        },
        {
          "description": "metric 4 distance to property type less than static value",
          "id": "a79012a7-d691-49ad-9a2b-178b6113db94",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "CALCULATION",
                "leftOperand": {
                  "leftOperand": {
                    "type": "METRIC",
                    "id": "e96b26f1-11a1-4dc2-b9f1-b513a17b27bc"
                  },
                  "arithmeticOperator": "DISTANCE",
                  "rightOperand": {
                    "type": "PROPERTY_TYPE",
                    "id": "19fb1502-d46a-4681-8930-376c51c9e4c5"
                  }
                }
              },
              "comparisonOperator": "LESS_THAN",
              "rightOperand": {
                "type": "STATIC_VALUE",
                "number": 100
              }
            }
          ]
        },
        {
          "description": "metric 5 location in property type area",
          "id": "a79012a7-d691-49ad-9a2b-178b6113db94",
          "inputConditions": [
            {
              "type": "GEOFENCE",
              "leftOperand": {
                "type": "PROPERTY_TYPE",
                "id": "4b4e9376-c534-4846-bac2-f4b4ea6aa82f"
              },
              "arithmeticOperator": "CONTAINS",
              "rightOperand": {
                "type": "METRIC",
                "id": "3816ff23-70f8-479c-a5e7-4bb77a2a5320"
              }
            }
          ]
        }
      ]
    },
    {
      "eventLevel": "WARNING",
      "conditionSets": [
        {
          "description": "change condition and mixed condition",
          "id": "b7c667de-3fb6-47d3-88ee-0bfbb7d7756a",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "STATIC_VALUE",
                "number": 10.6
              },
              "comparisonOperator": "EQUALS",
              "rightOperand": {
                "type": "PROPERTY_TYPE",
                "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
              }
            },
            {
              "leftOperand": {
                "type": "VALUE_CHANGE",
                "arithmeticOperator": "DIFFERENCE",
                "leftOperand": {
                  "type": "METRIC",
                  "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc"
                },
                "rightOperand": {
                  "type": "METRIC",
                  "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc",
                  "offset": {
                    "type" : "PREVIOUS_VALUE"
                  }
                }
              },
              "comparisonOperator": "EQUALS",
              "rightOperand": {
                "type": "PROPERTY_TYPE",
                "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
              }
            }
          ]
        }
      ]
    },
    {
      "eventLevel": "INFORMATION",
      "conditionSets": [
        {
          "description": "calculation",
          "id": "c7042dd3-7396-4626-9ada-2f39a5e173d7",
          "inputConditions": [
            {
              "type": "THRESHOLD",
              "leftOperand": {
                "type": "CALCULATION",
                "arithmeticOperator": "DIVISION",
                "leftOperand": {
                  "type": "METRIC",
                  "id": "574fe135-ab2f-4df5-b640-a40b41d2e3dc"
                },
                "rightOperand": {
                  "type": "STATIC_VALUE",
                  "number": 99.5
                }
              },
              "comparisonOperator": "LESS_THAN_OR_EQUALS",
              "rightOperand": {
                "type": "PROPERTY_TYPE",
                "id": "1f68f53f-0505-4560-8e45-80f67abfeae3"
              }
            }
          ]
        }
      ]
    }
  ],
  "subjectFilter": {
    "include": {
      "subjectIds": [
        "9eb8319b-f474-4eda-9de3-4169ddf9c607",
        "125b8167-eb00-4402-8fea-7406d4b5b295"
      ],
      "propertyValues": null
    },
    "exclude": null
  }
}

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.

Webhook Settings

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

Search webhook settings

HTTP Request

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

Example request

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

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

Example response

{
  "count": 1,
  "result": [
    {
      "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
      "createdDate": "2021-01-24T15:00:01.946+0000",
      "updatedDate": "2021-01-24T15:05:02.124+0000",
      "name": "Euro endpoint",
      "active": true,
      "endpoint": "https://euro.endpoint.com",
      "authorizationHeader": "Bearer SecretToken",
      "subjectFilter": {
        "include": {
          "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
          "propertyValues": [
            {
              "typeId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
              "valueIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
            }
          ]
        },
        "exclude": {
          "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
          "propertyValues": [
            {
              "typeId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
              "valueIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
            }
          ]
        }
      },
      "eventTriggerFilter": {
        "type": "EXCLUDE",
        "ids": ["1ba262d2-2627-4cf8-adc8-d2d36f693132"]
      },
      "eventLevelFilter": ["WARNING", "PROBLEM"]
    }
  ]
}

Search and filter webhook settings. Results are paginated with a maximum of 200 results at a time.

Parameters

Get a webhook setting

HTTP Request

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

Example request

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

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

Example response

{
  "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "name": "Euro endpoint",
  "active": true,
  "endpoint": "https://euro.endpoint.com",
  "authorizationHeader": "Bearer SecretToken",
  "subjectFilter": {
    "include": {
      "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
      "propertyValues": [
        {
          "typeId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
          "valueIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
        }
      ]
    },
    "exclude": {
      "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
      "propertyValues": [
        {
          "typeId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
          "valueIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
        }
      ]
    }
  },
  "eventTriggerFilter": {
    "type": "EXCLUDE",
    "ids": ["1ba262d2-2627-4cf8-adc8-d2d36f693132"]
  },
  "eventLevelFilter": ["WARNING", "PROBLEM"]
}

Fetch an existing webhook setting.

Parameters

This endpoint takes no arguments.

Create or update a webhook setting

Create a new webhook setting or update an existing one.

HTTP Request

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

Update
PUT https://api.blockbax.com/v1/projects/<PROJECT_ID>/webhookSettings/<WEBHOOK_SETTING_ID>

Example request

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

curl -X POST "https://api.blockbax.com/v1/projects/${project_id}/webhookSettings"
or
curl -X PUT "https://api.blockbax.com/v1/projects/${project_id}/webhookSettings/${webhook_setting_id}"
  -H "Authorization: ApiKey ${api_key}"
  -H "Content-Type: application/json"
  -d '{
        "name": "Euro endpoint",
        "active": true,
        "endpoint": "https://euro.endpoint.com",
        "authorizationHeader": "Bearer SecretToken",
        "subjectFilter": {
          "include": {
            "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
            "propertyValues": [
              {
                "typeId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
                "valueIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
              }
            ]
          },
          "exclude": {
            "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
            "propertyValues": [
              {
                "typeId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
                "valueIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
              }
            ]
          }
        },
        "eventTriggerFilter": {
          "type": "EXCLUDE",
          "ids": ["1ba262d2-2627-4cf8-adc8-d2d36f693132"]
        },
        "eventLevelFilter": [
          "WARNING", "PROBLEM"
        ]
      }'

Example response

{
  "id": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "createdDate": "2021-01-24T15:00:01.946+0000",
  "updatedDate": "2021-01-24T15:05:02.124+0000",
  "name": "Euro endpoint",
  "active": true,
  "endpoint": "https://euro.endpoint.com",
  "authorizationHeader": "Bearer SecretToken",
  "subjectFilter": {
    "include": {
      "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
      "propertyValues": [
        {
          "typeId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
          "valueIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
        }
      ]
    },
    "exclude": {
      "subjectIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"],
      "propertyValues": [
        {
          "typeId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
          "valueIds": ["f59ee376-ccec-40e1-8ebe-38bef7a30ac9"]
        }
      ]
    }
  },
  "eventTriggerFilter": {
    "type": "EXCLUDE",
    "ids": ["1ba262d2-2627-4cf8-adc8-d2d36f693132"]
  },
  "eventLevelFilter": ["WARNING", "PROBLEM"]
}

Body

Delete a webhook setting

Delete an existing webhook setting.

HTTP Request

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

Example request

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

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

Example response

{}

Parameters

This endpoint takes no arguments.

Search webhook responses

HTTP Request

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

Example request

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

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

Example response

[
  {
    "webhookSettingId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
    "sequenceNumber": 10,
    "deliveryAttempt": 1,
    "date": "2021-01-24T15:05:02.124+0000",
    "statusCode": 200,
    "responseType": "OK_RESPONSE",
    "error": false,
    "eventId": "fe61694a-7490-47a3-a92f-4576cd5a0835"
  },
  {
    "webhookSettingId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
    "sequenceNumber": 11,
    "deliveryAttempt": 5,
    "date": "2021-01-24T15:10:02.124+0000",
    "statusCode": 404,
    "responseType": "ERROR_RESPONSE",
    "error": true,
    "eventId": "ef61694a-7490-47a3-a92f-4576cd5a3677"
  },
  {
    "webhookSettingId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
    "sequenceNumber": 12,
    "deliveryAttempt": 5,
    "date": "2021-01-24T15:15:02.124+0000",
    "responseType": "CONNECTION_ERROR",
    "error": true,
    "eventId": "ef61694a-7490-47a3-a92f-4576cd5a3677"
  }
]

Search and filter webhook responses. Results can be paged through by setting size and cursor.

Parameters

Get webhook response

HTTP Request

GET https://api.blockbax.com/v1/projects/<PROJECT_ID>/webhookSettings/<WEBHOOK_SETTING_ID>/webhookResponses/<SEQUENCE_NUMBER>

Example request

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

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

Example response

{
  "webhookSettingId": "08efb2ce-18d2-4aa1-9f8c-f745386ad1ac",
  "sequenceNumber": 10,
  "deliveryAttempt": 1,
  "date": "2021-01-24T15:05:02.124+0000",
  "statusCode": 200,
  "responseType": "OK_RESPONSE",
  "error": false,
  "eventId": "fe61694a-7490-47a3-a92f-4576cd5a0835"
}

Fetch an existing webhook 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?subjectIds=<SUBJECT_IDS>&metricIds=<METRIC_IDS>&fromDate=<FROM_DATE>&toDate=<TO_DATE>

Example request

api_key=<API_KEY>
project_id="715b6935-e3d8-48b1-86a3-a6e2a268e1f"
subject_ids="f59ee376-ccec-40e1-8ebe-38bef7a30ac9"
metric_ids="7c40cc50-aa51-4eb2-8937-71ce62798f17, 5d9109db-d88f-4831-aa61-871a51498784"
from_date="2021-01-02T00:00:00.000+02:00"
to_date="2021-01-03T00:00:00.000+02:00"

curl -G --data-urlencode "fromDate=${from_date}" --data-urlencode "toDate=${to_date}" "https://api.blockbax.com/v1/projects/${project_id}/measurements?subjectIds=${subject_ids}&metricIds=${metric_ids}"
  -H "Authorization: ApiKey ${api_key}"

Example response

{
  "series": [
    {
      "subjectId" : "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
      "metricId" : "7c40cc50-aa51-4eb2-8937-71ce62798f17",
      "measurements": [
        {
          "date": "2021-01-02T15:00:01.946+0000",
          "number": 22.1
        },
        {
          "date": "2021-01-02T15:00:01.976+0000",
          "number": 22.2
        }
      ]
    },
    {
      "subjectId" : "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
      "metricId" : "5d9109db-d88f-4831-aa61-871a51498784",
      "measurements": [
        {
         "date": "2021-01-02T15:05:02.124+0000",
         "location": {
           "lat": 10.3, "lon": 20.2, "alt": 30.1
        }
      }
      ]
    },
    {
      "subjectId" : "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
      "metricId" : "8161ee9f-d84d-40bd-bbfe-f3bd20285e8c",
      "measurements": [
        {
         "date": "2021-01-02T15:05:02.124+0000",
         "text": "LowTirePressureAlarm"
      }
      ]
    }
  ]
}

Fetch existing measurements. If you pass a date range, you must pass exactly one subject and one metric ID. If you do not pass a date range, you can pass none or multiple IDs and you will get the latest measurements for those IDs, or no filter on subjects/metrics when not passing the argument.

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": "2021-01-09T12:00:00.000+00:00",
                "number": 10.3
              },
              {
                "date": "2021-01-09T12:01:00.000+00:00",
                "number": 11.5
              }
            ]
          },
          {
            "ingestionId": "MyCar$Location",
            "measurements": [
              {
                "date": "2021-01-09T12:00:00.000+00:00",
                "location": {
                  "lat": 10.3, "lon": 11.2, "alt": 12.1
                }
              }
            ]
          },
          {
            "ingestionId": "MyCar$Status",
            "measurements": [
              {
                "date": "2021-01-09T12:00:00.000+00:00",
                "text": "LowTirePressureAlarm"
              }
            ]
          }
        ]
      }'

Example response

{
  "numberOfIngestedMeasurements": 2,
  "message": "There were issues while processing the payload. The specific issues are listed in the 'detailedMessages' property.",
  "detailedMessages": [
    "Tried to save measurements for ingestion ids: MyHouse$LivingRoomTemperature, MyCar$Location. These ingestion ids could not be found or you have no access to the corresponding subject.",
    "Received invalid measurement values for ingestion ids: MyHouse$Humidity. Verify that the sent value is of the correct type for the metric data type, and that the value meets the requirements stated in the API docs at https://blockbax.com/docs/api/#send-measurements.",
    "Received measurement values for ingestion ids: Office$Temperature were truncated before ingestion. Number metrics, latitude, longitude and altitude are rounded to 8 fractional numbers. String metrics are truncated to 1000 characters."
  ]
}

Send new measurements. Must be either a measurement with number, location or text value. In case your request is syntactically correct, but not everything can be ingested you will receive a 207 (MULTI_STATUS) response with details in the response. It is possible to automatically create subjects by enabling this on a default inbound connector in your project settings.

If you are unable to work with the default payload format you can write your own custom JavaScript payload conversion function using inbound connectors.

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=2021-01-03T13:00:00.000Z&toDate=2021-01-10T13:00:00.000Z&subjectIds=<SUBJECT_IDS>&eventTriggerIds=<EVENT_TRIGGER_IDS>&eventLevels=problem,warning&page=0&size=20&sort=startDate,desc"
  -H "Authorization: ApiKey ${api_key}"

Example response

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

Search and filter events. Results are paginated with a maximum of 200 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",
  "eventTriggerVersion": 8,
  "eventLevel": "PROBLEM",
  "subjectId": "f59ee376-ccec-40e1-8ebe-38bef7a30ac9",
  "conditionSetIds": ["7c40cc50-aa51-4eb2-8937-71ce62798f17"],
  "startDate": "2021-01-10T07:15:21.005+0000",
  "endDate": "2021-01-10T11:28:11.460+0000"
}

Fetch an existing event.

Parameters

This endpoint takes no arguments.