HTTP Mqtt Connection Create


Required Fields


destination
The path of to the Flow where Drops will be written.
topic
Mqtt broker topic.
uri
Mqtt broker connection uri. Typically this will be something like "tcp://yourbrokerhost:1883", though any uri is acceptable as long as it has a valid scheme - "tcp" or any connection strings that begin with "ssl" or "tls" (to allow for versioning)

Optional Fields


displayName
A descriptive name for the Task
description
Further information used to describe the Task
reportFrequency
Task reporting interval. This will be set to 1 hour if the value is omitted.
username
Username for authenticating with the mqtt broker. If omitted the connection will be attempted without a username.
password
Password for authenticating with the mqtt broker. If omitted the connection will be attempted without a password
description
Further information used to describe the Task

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

Creates a new MQTT Task object

Request


Headers

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

Example

{
  "uri": "tcp://localhost:1883",
  "topic": "abcdef",
  "destination": "/some/flow/path",
  "reportFrequency": 300000,
  "displayName": "My Mqtt Task",
  "username": "broker_username",
  "password": "broker_password"
}

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" : "m54ab5d230cf25a3da95ae309",
    "creationDate" : 1420516643503,
    "creatorId" : "i54ab092d0cf29d26771d0026",
    "description" : "A test task to demonstrate connection to an Mqtt broker",
    "destination" : "/bob/aclxxnfktm",
    "displayName" : "My Mqtt Task",
    "uri": "tcp://localhost:1883",
    "password" : "broker_password",
    "qos" : 1,
    "reportFlowId" : "f54ab5d230cf25a3da95ae30b",
    "reportFrequency" : 300000,
    "reportPath" : "/bob/:reports/m54ab5d230cf25a3da95ae309-report",
    "status" : "ok",
    "topic" : "npgjxxbnbc",
    "username" : "broker_username"
  }
}