Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Introduction

This document describes how to use the Beacon Metrics API to retrieve historical metric data from Bluzone. Note: data older than 6 months is not available through any of these APIs.

Get aggregate metrics by beacon

Method

GET

URL
https://bluzone.io/portal/papis/v1/history/metric/{projectId}
Response Content-Typeapplication/json OR text/csv (depending on the format parameter)
Headerbzid
DescriptionGet history of a single metric. If a beacon is not specified, the API will return the data for all the beacons in the project


Parameters

Type

Name

Required

Description

Schema

Default

Path

projectId

YES

The project Id, e.g. 1111.

int64

Query

beaconId

NO

The id of the beacon, e.g. beaconId=111111111111111

Multiple beaconIds should be separated by commase.g. beaconId=1,2,3

string <array>

 **all beacons in project

Query

blufiId

NO

The ids of the blufise.g. blufiId=111.

Multiple blufiIds should be separated by commase.g. blufiId=1,2,3 

For RSSI metrics, this is the ids that you want returned. This allows to you to only n blufi rssi values.

string <array>

Query

interval

YES

The interval for the metric, i.e. the granularity of the data, e.g.interval=1d

enum

  • 1d
  • 1s
  • 1m
  • 1H

Query

metric

YES

The type of metric requested, e.g.metric=RSSI.

enum

  • TEMP
  • RSSI
  • PER_BLUFI_RSSI
  • LUMS
  • X_ACCEL
  • Y_ACCEL
  • Z_ACCEL
  • X_ACCEL_HS
  • Y_ACCEL_HS
  • Z_ACCEL_HS
  • X_MAG
  • Y_MAG
  • Z_MAG
  • X_VELOCITY
  • Y_VELOCITY
  • Z_VELOCITY
  • MAG_STATE
  • BATTERY

Query

startDate

YES

The start date of the data requested. Must be in ISO 8601 format compliant, e.g.startDate=2017-09-11T13:39:57.420Z.

string 


Query

endDate

YES

The end date of the data requested. Must be in ISO 8601 format compliante.g. endDate=2017-09-25T13:39:57.421Z.

string


Query

format

YES

The desired format of the data, e.g. format=json

enum

  • json
  • csv

Query

download

NO

Whether to include a Content-Disposition header, e.g.Content-Disposition: attachment; filename="mag-state-aggregation_project-3089_09-20-2017_13-39-57-09-24-2017_13-39-57.json"

boolean

true

Request

Request
curl -X GET \
https://bluzone.io/portal/papis/v1/history/metric/$PROJECT_ID?beaconId=$BEACON_ID&metric=TEMP&interval=1d&endDate=2019-02-20T20:30:40.140Z&startDate=2019-02-17T20:30:40.140Z&includeZeros=true&format=json&merge=true&_=1550694639186 \
-H 'bzid: $PROJECT_API_KEY'

Response

Response
[
    {
        "metric": "temp",
        "id": {beaconId},
        "keyAsString": "2019-02-18T00:00:00Z",
        "key": 1550448000,
        "count": 3774,
        "sum": 87441.25,
        "avg": 23.169382617912028,
        "rms": 0,
        "rmsPeak": 0,
        "min": 21.25,
        "peak": 25,
        "peakToPeak": 3.75
    },
    {
        "metric": "temp",
        "id": {beaconId},
        "keyAsString": "2019-02-19T00:00:00Z",
        "key": 1550534400,
        "count": 3236,
        "sum": 66882,
        "avg": 20.668108776266997,
        "rms": 0,
        "rmsPeak": 0,
        "min": 19.75,
        "peak": 21.5,
        "peakToPeak": 1.75
    },
    {
        "metric": "temp",
        "id": {beaconId},
        "keyAsString": "2019-02-20T00:00:00Z",
        "key": 1550620800,
        "count": 3336,
        "sum": 68010.75,
        "avg": 20.3869154676259,
        "rms": 0,
        "rmsPeak": 0,
        "min": 19.75,
        "peak": 21.5,
        "peakToPeak": 1.75
    }
]




Method

GET

URL
https://bluzone.io/portal/papis/v1/history/storage/download/{projectId} 
Response Content-Typeapplication/json
Headerbzid
DescriptionStorage data in json format

Parameters

Type

Name

Required

Description

Schema

Default

Path

projectId

YES

The project Id, e.g. 3089.

int64

Query

beaconId

NO

The id of the beacon, e.g. beaconId=111111111111111

Multiple beaconIds should be separated by commase.g. beaconId=1,2,3

string

 **all beacons in project

Query

startDate

YES

The start date of the data requested. Must be in ISO 8601 format compliant, e.g.startDate=2017-09-11T13:39:57.420Z.

string 


Query

endDate

YES

The end date of the data requested. Must be in ISO 8601 format compliante.g. endDate=2017-09-25T13:39:57.421Z.

string


Query

download

NO

Whether to include a Content-Disposition header, e.g.Content-Disposition: attachment; filename="mag-state-aggregation_project-3089_09-20-2017_13-39-57-09-24-2017_13-39-57.json"

boolean

false

QuerydataTypeYES

The advertisement data being request, e.g. dataType=motion.

enum <array>

  • sSpec
  • unknown
  • hearRate
  • sBv1
  • sBv2
  • tracking
  • sLight
  • sSns
  • sSnsNano
  • sSnsSummary
  • motion
  • mag
  • iBeacon
  • eddystoneUid
  • eddystoneUrl
  • eddystoneTlm
  • deviceStat
  • blufiProps
  • blufiCon
  • probe
  • df

Request

Request
curl -X GET \
https://bluzone.io/portal/papis/v1/history/storage/download/$PROJECT_ID?startDate=2017-09-20T13:39:57.420Z&endDate=2017-09-24T13:39:57.420Z&dataType=sSns \
-H 'bzid: $PROJECT_API_KEY

Reponse

Response
{
   "advData":{
      "id": {beaconId},
      "time":1506014675,
      "eventCounter":[
         16,
         6,
         14
      ],
      "xAccel":0.01953125,
      "yAccel":0.0078125,
      "zAccel":0.02734375,
      "adapter":{
         "type":3,
         "gid":"0E61B3B3-BD15-4F42-BD0D-04AEA34D5B13"
      }
   },
   "environment_name":"bzprod",
   "projectId":3089,
   "serverTimestamp":1506014675000,
   "type":"sSns"
}


Method

GET

URL
https://bluzone.io/portal/papis/v1/history/metric/aggregate/{projectId} 
Response Content-Typeapplication/json OR text/csv (depending on the format parameter)
Headerbzid
DescriptionGet all aggregate metric history for a beacon(s)

Parameters

Type

Name

Required

Description

Schema

Default

Path

projectId

YES

The project Id, e.g. 3089.

int64

Query

beaconId

NO

The id of the beacon, e.g. beaconId=111111111111111

Multiple beaconIds should beseparated by commase.g. beaconId=1,2,3

string


Query

interval

YES

The interval for the metric, i.e. the granularity of the data, e.g.interval=1d

enum

  • 1d
  • 1s
  • 1m
  • 1H

Query

startDate

YES

The start date of the data requested. Must be in ISO 8601 format compliant, e.g. startDate=2017-09-11T13:39:57.420Z.

string 


Query

endDate

YES

The end date of the data requested. Must be in ISO 8601 format compliante.g. endDate=2017-09-25T13:39:57.421Z.

string


Query

format

YES

The desired format of the data, e.g. format=json

enum

  • json
  • csv

Query

download

NO

Whether to include a Content-Disposition header, e.g.Content-Disposition: attachment; filename="mag-state-aggregation_project-3089_09-20-2017_13-39-57-09-24-2017_13-39-57.json"

boolean

false

Request 

Request
curl -X GET \
https://bluzone.io/portal/papis/v1/history/metric/aggregate/$PROJECT_ID?beaconId=$BEACON_ID&interval=1d&startDate=2017-09-20T13:39:57.420Z&endDate=2017-09-24T13:39:57.420Z&format=json \
-H 'bzid: $PROJECT_API_KEY

Response

Response
[
   {
      "id": {beaconId},
      "keyAsString":"2017-09-21T00:00:00Z",
      "key":1505952000,
      "tempCount":13153.0,
      "tempAvg":21.247001634608075,
      "tempSum":279461.8125,
      "rssiCount":13150.0,
      "rssiAvg":-48.440532319391636,
      "rssiSum":-636993.0,
      "lumsCount":1.0,
      "lumsAvg":138.0,
      "lumsSum":138.0,
      "magStateCount":17.0,
      "magStateAvg":0.47058823529411764,
      "batteryCount":13150.0,
      "batteryAvg":3609.9946768060836,
      "batterySum":4.747143E7,
      "tempPeak":27.25,
      "rssiPeak":0.0,
      "lumsPeak":138.0,
      "batteryPeak":3660.0,
      "magstateSum":8.0,
      "magStatePeak":1.0,
      "zaccelAvg":-0.44839638157894735,
      "zaccelRms":0.7144529620100675,
      "zaccelSum":-34.078125,
      "zaccelSqSum":38.793670654296875,
      "zaccelPeak":0.96484375,
      "zaccelMin":-1.21484375,
      "zaccelPeakToPeak":2.1796875,
      "xhsCount":0.0,
      "xhsRmsAvg":0.0,
      "xhsRmsSum":0.0,
      "xhsPeak":0.0,
      "xhsPeakToPeak":0.0,
      "yhsCount":0.0,
      "yhsRmsAvg":0.0,
      "yhsRmsSum":0.0,
      "yhsPeak":0.0,
      "yhsPeakToPeak":0.0,
      "zhsCount":0.0,
      "zhsRmsAvg":0.0,
      "zhsRmsSum":0.0,
      "zhsPeak":0.0,
      "zhsPeakToPeak":0.0,
      "xmagCount":17.0,
      "xmagAvg":359.88235294117646,
      "xmagSum":6118.0,
      "xaccelCount":76.0,
      "xaccelAvg":-0.006064967105263158,
      "xaccelRms":0.47803013939545264,
      "xaccelSum":-0.4609375,
      "xaccelSqSum":17.366973876953125,
      "xaccelPeak":0.84375,
      "xaccelMin":-1.0234375,
      "xaccelPeakToPeak":1.8671875,
      "yaccelCount":76.0,
      "yaccelAvg":-0.1953638980263158,
      "yaccelRms":0.42104968270724796,
      "yaccelSum":-14.84765625,
      "yaccelSqSum":13.473495483398438,
      "yaccelPeak":0.375,
      "yaccelMin":-0.9921875,
      "yaccelPeakToPeak":1.3671875,
      "zaccelCount":76.0,
      "xmagPeak":1720.0,
      "ymagCount":17.0,
      "ymagAvg":-834.4705882352941,
      "ymagSum":-14186.0,
      "ymagPeak":247.0,
      "zmagCount":17.0,
      "zmagAvg":1166.2941176470588,
      "zmagSum":19827.0,
      "zmagPeak":2497.0
   }
]

Method

GET

URL
https://bluzone.io/portal/papis/v1/history/metric/raw/{projectId}
Response Content-Typeapplication/json OR text/csv (depending on the format parameter)
Headerbzid
DescriptionGet raw metric history data

Parameters

Type

Name

Required

Description

Schema

Default

Path

projectId

YES

The project Id, e.g. 3089.

int64

Query

beaconId

NO

The id of the beacon, e.g. beaconId=111111111111111

Multiple beaconIds should be separated by commase.g. beaconId=1,2,3

string


Query

dataType

YES

The advertisement data being request, e.g. dataType=motion.

enum

  • sSnsSummary
  • sSnsNano
QuerystorageTypeYESDescribe how you would like the fetch the data. ALL will query both cache and long term storage for result. CACHE: only hits cache. STORAGE: only hits long term storage. For Example, storageType=all 

enum 

  • ALL
  • CACHE 
  • STORAGE

QueryfilterNO

Filter the type of raw metric. Each filter should be separated by a comma, e.g. filters=low_res,high_res

enum 

  • LOW_RES
  • HIGH_RES
  • ADV
  • NON_ADV

QuerydeviceJobIdNOFilter by deviceJobIdint64
QuerysessionIdNOFilter by sessionIdint64

Query

startDate

YESThe start date of the data requested. Must be in ISO 8601 format compliant, e.g. startDate=2017-09-11T13:39:57.420Z.

string 


Query

endDate

YES

The end date of the data requested. Must be in ISO 8601 format compliante.g. endDate=2017-09-25T13:39:57.421Z.

string


Query

format

YES

The desired format of the data, e.g. format=json

enum

  • json
  • csv

QueryheaderNOWhether to include headers in the CSV (only applicable when format=csv)booleantrue
QueryseparatorNOThe separator for the CSV response. By default, commas are used, if the separator is "eu" then semi-colons are used. Any separator can be used as long as it's only a single character, e.g. separator=(only applicable when format=csv)stringdefault

Request

Request
curl -X GET \
https://bluzone.io/portal/papis/v1/history/metric/raw/$PROJECT_ID?beaconId=$BEACON_ID&dataType=ssnssummary&storageType=all&startDate=2017-09-20T13:39:57.420Z&endDate=2017-09-24T13:39:57.420Z&format=json&storageType=all&filters=adv \
-H 'bzid: $PROJECT_API_KEY

Response

Response
{
   "beaconId":[
      {beaconId}
   ],
   "blufiId":null,
   "conditionSummary":{
      "yPeakToPeak":0.0,
      "adv":0.0,
      "highRes":0.0,
      "sourceTime":0.0,
      "xPeak":0.0,
      "xPeakToPeak":0.0,
      "xRms":0.0,
      "yPeak":0.0,
      "yRms":0.0,
      "zPeak":0.0,
      "zPeakToPeak":0.0,
      "zRms":0.0
   },
   "dateKey":123,
   "datesStringKey":"2017-09-20T13:39:57.420Z",
   "projectId": {projectId}
}

Method

GET

URL
https://bluzone.io/portal/papis/v1/history/addata/{projectId}/magstate 
Response Content-Typeapplication/json OR text/csv (depending on the format parameter)
Headerbzid
DescriptionGet remote condition monitoring data mag state aggregation

Parameters

Type

Name

Required

Description

Schema

Default

Path

projectId

YES

The project Id, e.g. 3089.

int64

Query

beaconId

NO

The id of the beacon, e.g. beaconId=111111111111111

Multiple beaconIds should be separated by commase.g. beaconId=1,2,3

string


Query

startDate

YESThe start date of the data requested. Must be in ISO 8601 format compliant, e.g. startDate=2017-09-11T13:39:57.420Z.

string 


Query

endDate

YES

The end date of the data requested. Must be in ISO 8601 format compliante.g. endDate=2017-09-25T13:39:57.421Z.

string


QueryformatYES

The desired format of the data, e.g. format=json

enum

  • json
  • csv

QuerybaseTempNO
float
QuerydetailsNO
booleanfalse
QuerydownloadNOWhether to include a Content-Disposition header, e.g.Content-Disposition: attachment; filename="mag-state-aggregation_project-3089_09-20-2017_13-39-57-09-24-2017_13-39-57.json"booleantrue
QueryrawNO
booleanfalse
QueryshowClosedNO
booleanfalse
QueryheaderNOWhether to include headers in the CSV (only applicable when format=csv)booleantrue
QueryseparatorNOThe separator for the CSV response. By default, commas are used, if the separator is "eu" then semi-colons are used. Any separator can be used as long as it's only a single character, e.g. separator=(only applicable when format=csv)

enum

  • default
  • eu
default

Request

Request
curl -X GET \
https://bluzone.io/portal/papis/v1/history/addata/3089/magstate?beaconId=1015467935288056038&startDate=2017-09-20T13:39:57.420Z&endDate=2017-09-24T13:39:57.420Z&format=json&showClosed=true&details=true \
-H 'bzid: $PROJECT_API_KEY

Response

Response
[
   {
      "beaconId":"1015467935288056038",
      "date":"2017-09-21T17:24:37Z",
      "duration":"1m 40s",
      "xMag":260.0,
      "yMag":-964.0,
      "zMag":1203.0,
      "temp":null,
      "opened":true
   },
   {
      "beaconId":"1015467935288056038",
      "date":"2017-09-21T17:26:17Z",
      "duration":"1s",
      "xMag":326.0,
      "yMag":-770.0,
      "zMag":1345.0,
      "temp":null,
      "opened":false
   },
   {
      "beaconId":"1015467935288056038",
      "date":"2017-09-21T17:26:18Z",
      "duration":"14s",
      "xMag":404.0,
      "yMag":-1056.0,
      "zMag":1243.0,
      "temp":null,
      "opened":true
   },
   {
      "beaconId":"1015467935288056038",
      "date":"2017-09-21T17:26:32Z",
      "duration":"3s",
      "xMag":270.0,
      "yMag":-597.0,
      "zMag":259.0,
      "temp":null,
      "opened":false
   }
]

Method

GET

URL
https://bluzone.io/portal/papis/v1/history/addata/{projectId}/rawData
Response Content-Typetext/csv
Headerbzid
DescriptionGet remote condition monitoring data mag state aggregation

Parameters

Type

Name

Required

Description

Schema

Default

Path

projectId

YES

The project Id, e.g. 3089.

int64

Query

beaconId

NO

The id of the beacon, e.g. beaconId=111111111111111

Multiple beaconIds should be separated by commase.g. beaconId=1,2,3

string


Query

startDate

YESThe start date of the data requested. Must be in ISO 8601 format compliant, e.g. startDate=2017-09-11T13:39:57.420Z.

string 


Query

endDate

YES

The end date of the data requested. Must be in ISO 8601 format compliante.g. endDate=2017-09-25T13:39:57.421Z.

string


QueryformatYES

The desired format of the data, e.g. format=csv

enum

  • csv

QuerybaseTempNO
float
QuerydetailsNO
booleanfalse
QuerydownloadNOWhether to include a Content-Disposition header, e.g.Content-Disposition: attachment; filename="mag-state-aggregation_project-3089_09-20-2017_13-39-57-09-24-2017_13-39-57.json"booleantrue
QueryrawNO
booleanfalse
QueryshowClosedNO
booleanfalse
QueryrcmOnlyNOWhether you only want remote condition monitoring data, e.g. rcmOnly=true

QueryheaderNOWhether to include headers in the CSV (only applicable when format=csv)booleantrue
QueryseparatorNOThe separator for the CSV response. By default, commas are used, if the separator is "eu" then semi-colons are used. Any separator can be used as long as it's only a single character, e.g. separator=(only applicable when format=csv)

enum

  • default
  • eu
default
QuerydataTypeYESThe advertisement data being request, e.g. dataType=sBv2

enum

  • sSpec
  • unknown
  • hearRate
  • sBv1
  • sBv2
  • tracking
  • sLight
  • sSns
  • sSnsNano
  • sSnsSummary
  • motion
  • mag
  • iBeacon
  • eddystoneUid
  • eddystoneUrl
  • eddystoneTlm
  • deviceStat
  • blufiProps
  • blufiCon
  • probe
  • df

Request

Request
curl -X GET \
https://bluzone.io/portal/papis/v1/history/addata/3089/rawData?format=csv&beaconId=1015467935288056038&startDate=2017-09-20T14:57:34.105Z&endDate=2017-09-24T14:57:34.105Z&dataType=sBv2 \
-H 'bzid: $PROJECT_API_KEY

Response

Response
blufiId,projectId,type,serverTimestamp,rssi,rssiCh,bpm,uuid,id,time,major,minor,measuredPower,sdc,bat,batt,temp,txPower,txChn,lums,eventCounter,xAccel,yAccel,zAccel,motion,raw,xMag,yMag,zMag,flags,bdId,gid,adFlags,adType,ad16bit,ad16bitMore,ad32bit,ad32bitMore,ad128bit,ad128bitMore,adNameShort,adNameLong,adPower,@timestamp,addr2,frameCount,instanceIdentifier,length,namespaceIdentifier,revision,ssid,started,staticHash,timeNano,uptime,url,xPeak,xPeakToPeak,xRms,yPeak,yPeakToPeak,yRms,zPeak,zPeakToPeak,zRms 
,{projectId},sBv2,1506014675000,0,0,0,,1015467935288056038,1506014675,0,0,0,0,0,0,0.0,0,0,138,,0.0,0.0,0.0,,,0,0,0,0,,0E61B3B3-BD15-4F42-BD0D-04AEA34D5B13,,,,,,,,,,,,,,0,,,,0,,0,,,0,,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 
  • No labels