HTTP Drop Create


Required Fields


elems
A map of data elements for the Drop. Values in the map may be of any data type that flowthings.io supports. If the type is not one that JSON supports, it must be supplied. See Drop Data Types for a list of types which must be specified in a {type:..., value:...} mapping.

Optional Fields


path
The path of the Flow where the Drop is to be written, only optional if the flowId is provided in the url of the POST.
location
A location for the Drop. For more on specification options, see Location Data.
fhash
Unique Drop hash value. System generated if Drop is created with fhash as a top-level property. See FHashes for further information.

Request


POST https://api.flowthings.io/v0.1/<account_id>/drop/

Creates a Drop where the Flow path is specified in the Drop.

POST https://api.flowthings.io/v0.1/<account_id>/drop/<flowId>

Creates a Drop in Flow <flowId>, the path can be excluded from the data.

Headers

NameDescription
Content-Typeapplication/json
X-Auth-TokenAuthentication Token

Example

{
  "path": "/my_account_id/my_first_flow",
  "location": {
    "lat": 40.703285,
    "lon": -73.987852
  },
  "elems": {
    "name": "foo",
    "error_rate": 0.15,
    "service_available": true,
    "status_codes": {
      "type": "sortedSet",
      "value": [
        {
          "type": "integer",
          "value": 100
        },
        {
          "type": "integer",
          "value": 90
        },
        {
          "type": "integer",
          "value": 100
        },
        {
          "type": "integer",
          "value": 75
        }
      ]
    },
    "stats": {
      "voltage": 15.4,
      "temp": 30.4,
      "uptime": 1992343.4
    }
  }
}

Response


HTTP Codes

CodeDescription
201Resource Created
400Bad Request
401Unauthorized
503Service Unavailable

Example Response Body

{
  "head": {
    "status": 201,
    "ok": true,
    "messages": [
      "Your request has been processed successfully. A new resource has been created."
    ],
    "errors": []
  },
  "body": {
    "id": "d540296740cf2ee54bcc4cf33",
    "flowId": "f540296740cf23301a89a5806",
    "creationDate": 1409455732680,
    "path": "/my_account_id/my_first_flow",
    "location": {
      "lat": 40.703285,
      "lon": -73.987852,
      "specifiers" : {}
    },
    "elems": {
      "error_rate": {
          "type": "float",
          "value": 0.15
      },
      "stats": {
          "type": "map",
          "value": {
            "temp": {
              "type": "float",
              "value": 30.4
            },
              "uptime": {
              "type": "float",
              "value": 1992343.4
            },
              "voltage": {
              "type": "float",
              "value": 15.4
            }
          }
      },
      "service_available": {
          "type": "boolean",
          "value": true
      },
      "status_codes": {
        "type": "sortedSet",
        "value": [
          {
            "type": "integer",
            "value": 75
          },
          {
            "type": "integer",
            "value": 90
          },
          {
            "type": "integer",
            "value": 100
          }
        ]
      },
      "name": {
        "type": "string",
        "value": "foo"
      }
    }
  }
}