All Collections
Release Notes
Release Notes v1.10
Release Notes v1.10

Bigtable Integration

B
Written by Ben Mills
Updated over a week ago

This document outlines the changes to the BitBrew platform and management APIs coming in our next release, December 14, 2017. There are changes to existing endpoints and new endpoints that should be carefully read and understood.

BitBrew's API documentation will be updated when the release has been successfully deployed to our production environment.

Table of Contents

  • Google Bigtable Integration

  • New Update Rule Endpoint

  • UDP Speeding Event Structure Modified

Google Bigtable Integration

You can now set up a Google Bigtable as a destination for data from the BitBrew platform and specify that destination in your rules. 

New Endpoint: Create a Google Bigtable Destination

[POST] /v1/tenants/{{tenantId}}/destinations/bigtable

+ Request Body
{
  "name": "my-bigtable-destination",
  "instanceId": "bigtable-demo",
  "tableName": "tableName",
  "cloudJson": {
    "type": "service_account",
    "project_id": "bigtable-testing-185714",
    "private_key_id": "62ccd61bf47eb3f2ecd6af766f6562f475d362e2",
    "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDPmpjRkX/WnpMP\nn+T6PXM0pUAawChxBEHUISVaFqOnkccLxzfNJ3r/BS0E2GJS3+tPjoj7s33DCNXb\nqePuaEqFJ7JtPVHGNzMOTsRk9cj1i/j7AWtBj9FzYoFr9OCGMXsq3WixGrmxIsvN\nRL1cgTU12zFd8pxot1XNIyBHKaHB+U7/bKCYogFT970/DSU2jcO9zw57oKrxxJEG\nRmNZclJk+FIY9Na0a1Twl6B3e09ZxOPB8JmAbjKOX0KmRQUBImbCTlanvPC2+Cwn\njZEMSO+ehgf02aQ9Ug0RAMGi30/XS93FBGPm46fGP1dLmvHUBk8h0T07k1PeTCOJ\nWR4FAWKDAgMBAAECggEAXtKwJlic2XyIk0RnI91Zd5xbEVzfm+9j2e5hzyo0Cd/N\n2JVf6Xa0+TKpK4NiNZRNOINUEhNDyAeLFtAcadJ85yDgoIC3jx+7VDeqAKs65NzQ\nFmXphYKZGmjN0G+C9gg3x7ZlkS8xzbSk/db93vitQzIg9FZSF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8dzQHmTCNQa9hLfDOX6o4fQ==\n-----END PRIVATE KEY-----\n",
    "client_email": "example@bigtable-testing-184714.iam.gserviceaccount.com",
    "client_id": "111420640089344752395",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://accounts.google.com/o/oauth2/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/example%40bigtable-testing-184714.iam.gserviceaccount.com"
  }
}

Once you've created the destination, you can use the destination ID in a rule to push data matching the rule parameters to that table.

Example Google Bigtable Rule

create rule AllEvents
using itemBody = { body = body, header = header }
where true
with Destination(
  item = json(bindings.itemBody),
  destinationId = '8b6a45a7-fdd5-4b54-a259-3b6955d1766c'
 )

New Endpoint: Update a Rule

This new endpoint replaces several calls and allows a user to enable or disable a rule with one call.

New Endpoint

[PUT] ../v1/tenants/{tenantId}/rules/{ruleName}

+ Request Body
{
   "enabled": true
}

Old Endpoints

The old rule enable and disable endpoints have been removed.

[POST] /v1/tenants/{tenantId}/rules/{ruleName}/enable 
[POST] /v1/tenants/{tenantId}/rules/{ruleName}/disable
  1. The new request uses a PUT  method instead of POST.

  2. The new request takes a body.

These are breaking changes.

UDP Speeding Event Structure Modification

To avoid confusion, the UDP Speeding Start and Speeding End messages have been distinguished.

Diff of Speeding End

{   
  "header": {...},
  "body": {
    "footer": 253,
    "message": {
-     "type": "OverSpeedingMessage",
+     "type": "OverSpeedingMessageEnd",
      "overSpeedType": "HighSpeed",
      "startTime": "2017-06-26T02:20:20Z",
      "initialLatitude": 42.04869079589844,
      "initialLongitude": -86.49169921875,
      "startODO": 6163,
      "duration": 158,
      "distance": 5.300000190734863,
      "peakSpeed": 124,
      "averageSpeed": 122
        },
    "header": {
      "timestamp": "2017-06-25T22:22:58-04:00",
      "tripType": "Unknown",
      "tripNumber": 327,
      "messageType": 3,
      "messageLength": 24,
      "latitude": 42.06966781616211,
      "longitude": -86.4334945678711,
      "fixQuality": "FixOk",
      "vehicleProtocolId": "ISO15765_11_BIT_CAN",
      "odo": 6168
      }
    }
}

Diff of Speeding Start Message

{
  "header": {...},
  "body": {
    "footer": 253,
    "message": {
-     "type": "OverSpeedingMessage",
+     "type": "OverSpeedingMessageStart",
      "startTime": "2017-06-26T02:20:20Z",
      "initialLatitude": 42.04869079589844,
      "initialLongitude": -86.49169921875,
      "startODO": 6163
-     "overSpeedType": "Unknown",
-     "duration": 0,
-     "distance": 0,
-     "peakSpeed": 0,
-     "averageSpeed": 0
    },
    "header": {
      "timestamp": "2017-06-25T22:22:58-04:00",
      "tripType": "Unknown",
      "tripNumber": 327,
      "messageType": 22,
      "messageLength": 24,
      "latitude": 42.04963302612305,
      "longitude": -86.49064636230469,
      "fixQuality": "FixOk",
      "vehicleProtocolId": "ISO15765_11_BIT_CAN",
      "odo": 6168
}
}
}
Did this answer your question?