Back to top

Draft

Note: This is early draft and its going to up to many changes. Preview purposes only.

Accounts 

This section describes about accounts

Account 

Register New Account
/accounts

Registers a new user account

Example

curl -X "POST" "http://api.thingsee.com/v2/accounts" \
  -H "Content-type: application/json" \
  -d $'{
  "email": "joe@thingsee.com",
  "password": "1amjoe"
}'
  • Request
  • Headers
    Content-Type: application/json
    Body
    {
      "email" : "joe@thingsee.com",
      "password" : "1amjoe"
    }
    
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "timestamp" : 1381537803046,
      "accountAuthUuid" : "6f72bc60-32d5-11e3-92e2-e94f95fc16a6",
      "accountAuthToken" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA"
    }
    
  • Response  400
  • Response  409
  • Response  500
Update Account
/accounts

Updates the user account

Example

curl -X "PUT" "http://api.thingsee.com/v2/accounts" \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQzMTQ5OTIwNzYzNywidXVpZCI6ImE1NDJhYTAwLWQyMDAtMTFlNC04YTMyLTBmOTM2Nzc4ZDFlOCIsInNjb3BlIjpbImFsbDphbGwiXSwiaWF0IjoxNDMxNDk5MjA3LCJleHAiOjE0MzIxMDQwMDd9.ri4w2bsuSw_kbx57o3vgcht-3TJftJRdVHn5JmtNKmY" \
  -d $'{
              "name": "Joel"
}'
  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
    Body
    {
      "name": "Jimmy",
      "apn": [
        {
          "token": "newapntoken"
        }
      ]
    }
    
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "timestamp" : 1381537803046
    }
    
  • Response  401
  • Response  500
Get Account
/accounts

Gets the user account information

Example

curl -X "GET" "http:/api.thingsee.com/v2/accounts" \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQzMTQ5OTIwNzYzNywidXVpZCI6ImE1NDJhYTAwLWQyMDAtMTFlNC04YTMyLTBmOTM2Nzc4ZDFlOCIsInNjb3BlIjpbImFsbDphbGwiXSwiaWF0IjoxNDMxNDk5MjA3LCJleHAiOjE0MzIxMDQwMDd9.ri4w2bsuSw_kbx57o3vgcht-3TJftJRdVHn5JmtNKmY"
  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "timestamp" : 1381537803046,
      "email" : "john@thingsee.com"
    }
    
  • Response  401
  • Response  500
Delete Account
/accounts

Deletes user account and all promises, events and devices that are bound to the account.

Example

curl -X "DELETE" "http://api.thingsee.com/v2/accounts" \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQzMTQ5OTIwNzYzNywidXVpZCI6ImE1NDJhYTAwLWQyMDAtMTFlNC04YTMyLTBmOTM2Nzc4ZDFlOCIsInNjb3BlIjpbImFsbDphbGwiXSwiaWF0IjoxNDMxNDk5MjA3LCJleHAiOjE0MzIxMDQwMDd9.ri4w2bsuSw_kbx57o3vgcht-3TJftJRdVHn5JmtNKmY"
  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "timestamp" : 1381537803046,
      "message": "Account removed"
    }
    

Authenticate 

Authenticate Account
/accounts/login

Authenticates the user account

Example

curl -X "POST" "http://api.thingsee.com/v2/accounts/login" \
  -H "Content-type: application/json" \
  -d $'{
  "email": "joe@thingsee.com",
  "password": "1amjoe"
}'

  • Request
  • Headers
    Content-Type: application/json
    Body
    {
      "email": "joe@thingsee.com",
      "password": "1amjoe"
    }
    
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "timestamp": 1381537803046,
      "accountAuthUuid": "6f72bc60-32d5-11e3-92e2-e94f95fc16a6",
      "accountAuthToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA"
    }
    
  • Response  401
  • Response  500

Account events 

Get account events
/accounts/events{?limit}{?start}{?end}

Get account related events.

Example

curl -X "GET" "http://api.thingsee.com/v2/accounts/events" \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQzMTUxNjI0MjE5MCwidXVpZCI6IjhlOTA0YmQwLWY5NjItMTFlNC04NmUzLTM3MTVkNDkzNTYyNCIsInNjb3BlIjpbImFsbDphbGwiXSwiaWF0IjoxNDMxNTE2MjQyLCJleHAiOjE0MzIxMjEwNDJ9.mS5w0E9WvGpaGTr87sjeKuk9TB_sfpzVMFZlGnkmW6Q"


  • Parameters
  • limit
    integer (optional) Default: 10 Example: 5

    The maximum number of events to return (max value: 10 )

    start
    integer (optional) Default: 0 Example: 1381537803046

    The timestamp of the first event

    end
    integer (optional) Example: 1381537803046

    The timestamp of the last event in time range

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "events": [
        {
          "timestamp": 1430372105411,
          "type": "account",
          "event": "update",
          "accountAuthUuid": "3edfcad0-ee6c-11e4-9fcc-610ff3865cbf"
        },
        {
          "timestamp": 1430372083102,
          "type": "account",
          "event": "login",
          "accountAuthUuid": "3edfcad0-ee6c-11e4-9fcc-610ff3865cbf"
        }
      ]
    }
    
  • Response  401
  • Response  500

Devices 

This section describes about the devices

Device 

Register Device
/devices

Registers a new device and claims to user account

Example

curl -X "POST" "http://api.thingsee.com/v2/devices" \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQzMTUxNjI0MjE5MCwidXVpZCI6IjhlOTA0YmQwLWY5NjItMTFlNC04NmUzLTM3MTVkNDkzNTYyNCIsInNjb3BlIjpbImFsbDphbGwiXSwiaWF0IjoxNDMxNTE2MjQyLCJleHAiOjE0MzIxMjEwNDJ9.mS5w0E9WvGpaGTr87sjeKuk9TB_sfpzVMFZlGnkmW6Q" \
  -d $'{
  "device": {
    "name": "myDevice",
    "swName": "1",
    "swVersion": "1",
    "hwVersion": "1",
    "serial": "myDeviceSerial"
  },
  "module": [
    {
      "moduleId": "1",
      "moduleName": "moduleName",
      "senses": [
        {
          "sId": "1"
        }
      ]
    }
  ]
}'
  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
    Body
    {
      "device": {
        "name": "My ThingSee One",
        "swName": "Thingsee B2.0",
        "swVersion": "2015.01.31",
        "hwVersion": "B1.5_0302",
        "serial": "XMB50NCC1701"
      },
      "module": [{
        "moduleId": "B4d455",
        "moduleName": "ThingseeOne",
        "senses": [{
          "sId": "0x01020100",
          "min": -99.999,
          "max": 99.999,
          "minInterval": 300
        }]
      }]
    }
    
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "connectorId" : 1, 
      "connectorName" : "Thingsee Cloud", 
      "protocol" : "http", 
      "host" : "127.0.0.7", 
      "port" : 80,
      "deviceAuthUuid": "aa34fsac-32d5-11e3-92e2-e94f95fc1212",
      "deviceAuthToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA",
      "timestamp": 1381537803046
    }
    
  • Response  500
  • Headers
    Content-Type: application/json
    Body
    {
      "timestamp" : 1381537803046
    }  
    
Get user devices
/devices

Get list of user devices

Example

curl -X "GET" "http://api.thingsee.com/v2/devices" \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQzMTUxNjI0MjE5MCwidXVpZCI6IjhlOTA0YmQwLWY5NjItMTFlNC04NmUzLTM3MTVkNDkzNTYyNCIsInNjb3BlIjpbImFsbDphbGwiXSwiaWF0IjoxNDMxNTE2MjQyLCJleHAiOjE0MzIxMjEwNDJ9.mS5w0E9WvGpaGTr87sjeKuk9TB_sfpzVMFZlGnkmW6Q"
  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "devices": [{
        "uuid": "6f72bc60-32d5-11e3-92e2-e94f95fc16a6",
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA",
        "state":  {
          "ts": 1381537803046,
          "puId": 1,
          "stId": 1
        }
      }],
      "timestamp": 1381537803046
    }
    
  • Response  401
  • Response  500

Device Configuration 

Get Configuration
/devices/{deviceAuthUuid}/configuration

Retrieves the device information and configuration

Example

curl -X "GET" "http://api.thingsee.com/v2/devices/11690010-f963-11e4-86e3-3715d4935624/configuration" \
  -H "Content-type: application/json" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQzMTUxNjI0MjE5MCwidXVpZCI6IjhlOTA0YmQwLWY5NjItMTFlNC04NmUzLTM3MTVkNDkzNTYyNCIsInNjb3BlIjpbImFsbDphbGwiXSwiaWF0IjoxNDMxNTE2MjQyLCJleHAiOjE0MzIxMjEwNDJ9.mS5w0E9WvGpaGTr87sjeKuk9TB_sfpzVMFZlGnkmW6Q"
  • Parameters
  • deviceAuthUuid
    string (required) Example: 6f72bc60-32d5-11e3-92e2-e94f95fc16a6

    The uuid of the device

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Body
    {
      "device": {
        "name": "My ThingSee One",
        "swName": "Thingsee B2.0",
        "swVersion": "2015.01.31",
        "hwVersion": "B1.5_0302",
        "serial": "XMB50NCC1701"
      },
      "module": [{
        "moduleId": "B4d455",
        "moduleName": "ThingseeOne",
        "senses": [{
          "sId": "0x01020100",
          "min": -99.999,
          "max": 99.999,
          "minInterval": 300
        }]
      }],
      "currentProfile": {
        //current device profile or empty
      },
      "pendingProfile" : {
        //pending device profile or empty
      }, 
      "state" : {
        "puId":0,
        "stId":2,
        "ts":1423566264120
      }
    }
    
  • Response  500
Update Configuration
/devices/{deviceAuthUuid}/configuration

Updates a device

  • Parameters
  • deviceAuthUuid
    string (required) Example: 6f72bc60-32d5-11e3-92e2-e94f95fc16a6

    The uuid of the device

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
    Body
      {
        "device": {
          "name": "My ThingSee One",
          "swName": "Thingsee B2.0",
          "swVersion": "2015.01.31",
          "hwVersion": "B1.5_0302",
          "serial": "XMB50NCC1701"
        },
        "module": [{
          "moduleId": "B4d455",
          "moduleName": "ThingseeOne",
          "senses": [{
            "sId": "0x01020100",
            "min": -99.999,
            "max": 99.999,
            "minInterval": 300
          }]
        }]
      }
    
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "timestamp": 1381537803046
    }
    
  • Response  500

Device Profile 

Install device profile
/devices/profile

Installing new profile on user devices

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
    Body
    {
      "deviceAuthUuids": ["4bbd2jm242dl5wmimbwz4rvlu77m0a4i"],
      "purposeUuids" : ["4bbd2jm242dl5wmimbwz4rvlu77m0a4i","4bbd2jm242dl5wmimbwz4rvlu77m0a4i"],
      "purposes" : [{
        "puId": 1,
        "name": "Humidity meter",
        "initStId": 1,
        "states": [{
          "stId": 1,
          "name": "Observing",
          "isGlobal": false,
          "events": [{
            "evId": 1,
            "name": "Threshold reached",
            "eventLog": false,
            "actions": {
              "sms": {
                "text": "Dry alert!",
                "phoneNumber": ["+35855506060909"]
              },
              "cloud": {
                "sendEvent": true,
                "sendLog": false,
                "sendPush": true
              },
              "engine": {
                "gotoStId": 1,
                "gotoPuId": 1
              },
              "display": {
                "showText": "Alert!"
              }
            },
            "causes": [{
              "sId": "0x01020100",
              "orderId": 1,
              "senseLog": true,
              "measurement": {
                "log": false,
                "interval": 10000,
                "count": 1
              },
              "threshold": {
                "count": 1,
                "negate": false,
                "relative": false,
                "decimalAcc": 1
              },
              "thresholds": {
                "isOneOf": [40, 90],
                "isGt": 90,
                "isLt": 40,
                "isNotIn": [1,2,3],
                "isInsideGeo": [{
                  "lat": 96.12312321,
                  "long": 80.53252353
                }]
              }
            }]
          }]
        }]
      }]
    }
    
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "timestamp" : 1381537803046,
      "state" : "pending",
      "pId" : "550a85dab2b0947022b8c070"
    }
    
  • Response  500

Device Removal 

Remove device
/devices/{deviceAuthUuid}

Removes device and related device data

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Body
    {
      "timestamp": 1430385360629,
      "message": "Device deleted"
    }
    
  • Response  401

Events 

This section describes about the device events

Get events 

Get device events
/events/{deviceAuthUuid}{?type}{?senses}{?limit}{?start}{?end}

Get events. Events represent actions on ThingSee system related to device activities.

  • Parameters
  • deviceAuthUuid
    string (required) Example: 6f72bc60-32d5-11e3-92e2-e94f95fc16a6

    The uuid of the device.

    type
    string (optional) Example: sense

    The type of event.

    Choices:

    • device device events, ie. purposeChanged

    • sense events triggered by sensors

    senses
    string (optional) Example: 0x00121212

    Filter for sensors in sense type event. Separate by comma for multiple sensors

    limit
    integer (optional) Default: 10 Example: 5

    The maximum number of events to return (max value: 10 )

    start
    integer (optional) Default: 0 Example: 1381537803046

    The timestamp of the first event

    end
    integer (optional) Example: 1381537803046

    The timestamp of the last event in time range

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "events": [
      {
        "timestamp": 1430371755244,
        "type": "sense",
        "deviceAuthUuid": "0f00faa0-eef8-11e4-80f2-1962bdbc18e7",
        "cause": {
          "engine": {
            "pId": "5530dcd960516e9a0d46f3f9",
            "puId": 2,
            "stId": 1,
            "evId": 1,
            "ts": 1430371755244
          },
          "senses": [
            {
              "sId": "0x01010100",
              "val": 18,
              "ts": 1430371755244
            }
          ]
        }
      },
      {
        "type": "device",
        "timestamp": 1430371755244,
        "deviceAuthUuid": "0f00faa0-eef8-11e4-80f2-1962bdbc18e7",
        "event": "purposeChanged",
        "cause": {
          "engine": {
            "pId": "5530dcd960516e9a0d46f3f9",
            "puId": 2,
            "stId": 1,
            "evId": 1,
            "ts": 1430371755244
          }
        },
        "newValue": 2,
        "oldValue": 1
      }
      ]
    }
    
  • Response  401
  • Response  500

Purposes 

This section describes device purposes

Register Purpose 

Register New Purpose
/purposes

Register new purpose

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
    Body
    {
      "puId" : 1,
      "name" : "Bike tracker",
      "initStId" : 1,
      "states" : [{
        "stId" : 1,
        "name" : "Initial state",
        "isGlobal" : true,
        "events" : [{
          "evId" : 1,
          "name" : "Event name",
          "eventLog" : false,
          "actions" : {
            "sms" : {
              "text" : "message text",
              "phoneNumber" : ["0035843434343"]
            },
            "cloud": {
              "sendEvent" : true,
              "sendLog" : true,
              "sendPush" : false
            },
            "engine" : {
              "gotoStId" : 2,
              "gotoPuId" : 2,
            },
            "display" : {
              "showText" : "Action triggered!"
            } 
          },
          "causes" : [{
            "sId" : "0x00010200",
            "orderId" : 1,
            "senseLog" : false,
            "measurement" : { 
              "log" : "false",
              "interval" : 10000,
              "count" : 1000
            },
            "threshold" : {
              "count" : 10,
              "negate" : false,
              "relative" : false
            },
            "thresholds" : {
              "isOneOf" : [1,10],
              "isGt" : 1,
              "isLt" : 11,
              "isNotIn" : [2, 3, 4, 5, 6,7,8,9],
              "isAny" : false,
              "isInsideGeo" : [{
                  "lat"  : Number,
                  "long" : Number
              }]
            }
          }]
        }]
      }]
    }
    
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    { 
      "purposeUuid":"54dda33a4971b88d0a842b19",
      "timestamp":1423811386985
    }
    
  • Response  500
Get Purposes
/purposes

Retrieve user purposes

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    { "purposeUuids":
        ["557964d3d385910565387f2b","557964dad385910565387f2c"],
      "purposeNames":
        ["Car tracker #2","Car tracker #1"],
      "timestamp":1434019628393
    }
    
  • Response  401
  • Response  500

Get and Update 

Get Purpose
/purposes/{purposeUuid}

Retrieve purpose information

  • Parameters
  • purposeUuid
    string (optional) Example: 54dda33a4971b88d0a842b19

    The id of the purpose. If left empty, an array of account owned purpose UUIDs is returned.

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "puId" : 1,
      "initStId" : 1,
      "states" : [{
        "stId" : 1,
        "name" : "Watching",
        "isGlobal" : true,
        "events" : [{
          "evId" : 1,
          "eventLog" : false,
          "actions" : {
            "cloud": {
              "sendEvent" : true,
              "sendLog" : true,
              "sendPush" : false
            },
          },
          "causes" : [{
            "sId" : "0x00010200",
            "orderId" : 1,
            "senseLog" : false,
            "measurement" : { 
              "log" : "false",
              "interval" : 10000,
              "count" : 1000
            },
            "threshold" : {
              "count" : 10,
              "negate" : false,
              "relative" : false
            },
            "thresholds" : {
              "isOneOf" : [1,10],
              "isGt" : 1,
              "isLt" : 11,
              "isNotIn" : [2, 3, 4, 5],
              "isAny" : false,
              "isInsideGeo" : [{
                  "lat"  : Number,
                  "long" : Number
              }]
            }
          }]
        }]
      }]
    }
    
  • Response  401
  • Response  500
Update Purpose
/purposes/{purposeUuid}

Update purpose

  • Parameters
  • purposeUuid
    string (optional) Example: 54dda33a4971b88d0a842b19

    The id of the purpose. If left empty, an array of account owned purpose UUIDs is returned.

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
    Body
    {
      "puId" : 1,
      "name" : "Bike tracker",
      "initStId" : 1,
      "states" : [{
        "stId" : 1,
        "name" : "Initial state",
        "isGlobal" : true,
        "events" : [{
          "evId" : 1,
          "name" : "Event name",
          "eventLog" : false,
          "actions" : {
            "sms" : {
              "text" : "message text",
              "phoneNumber" : ["0035843434343"]
            },
            "cloud": {
              "sendEvent" : true,
              "sendLog" : true,
              "sendPush" : false
            },
            "engine" : {
              "gotoStId" : 2,
              "gotoPuId" : 2,
            },
            "display" : {
              "showText" : "Action triggered!"
            } 
          },
          "causes" : [{
            "sId" : "0x00010200",
            "orderId" : 1,
            "senseLog" : false,
            "measurement" : { 
              "log" : "false",
              "interval" : 10000,
              "count" : 1000
            },
            "threshold" : {
              "count" : 10,
              "negate" : false,
              "relative" : false
            },
            "thresholds" : {
              "isOneOf" : [1,10],
              "isGt" : 1,
              "isLt" : 11,
              "isNotIn" : [2, 3, 4, 5, 6,7,8,9],
              "isAny" : false,
              "isInsideGeo" : [{
                  "lat"  : Number,
                  "long" : Number
              }]
            }
          }]
        }]
      }]
    }
    
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "timestamp":1423811386985
    }
    
  • Response  401
  • Response  500
Delete Purpose
/purposes/{purposeUuid}

Delete purpose

  • Parameters
  • purposeUuid
    string (optional) Example: 54dda33a4971b88d0a842b19

    The id of the purpose. If left empty, an array of account owned purpose UUIDs is returned.

  • Request
  • Headers
    Content-Type: application/json
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6MTQyNjI1MzY4NjE4NiwidXVpZCI6Ik5hdWhndHksIG5hdWdodHkuLiIsInNjb3BlIjpbXSwiaWF0IjoxNDI2MjUzNjg2fQ.HV5Y3zJ8ssFVz_FdX38AxrcuTPQfgsBMeE9Xe93fhUA
  • Response  200
  • Response  401

Status 

Status 

Status
/status

Retrieve service status

  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
      "status": "online"
    }
    

Generated by aglio on 02 Mar 2016