Structure

Ubidots created a pre-defined structure to understand the content of your TCP/UDP packets. If you wish to implement a custom structure, please get in touch with our support channel.

USER_AGENT|POST|TOKEN|DEV_LABEL(:DEV_NAME)(@GLOBAL_TIMESTAMP)=>[VAR_LABEL:VALUE([$CONTEXT_KEY=CONTEXT_VAL]...)](@VARIABLE_TIMESTAMP)|end
USER_AGENT|POST|TOKEN|DEV_LABEL(:DEV_NAME)(@GLOBAL_TIMESTAMP)=>[VAR_LABEL:VALUE([$CONTEXT_KEY=CONTEXT_VAL]...)](@VARIABLE_TIMESTAMP); ... ;DEV_LABEL(:DEV_NAME)(@GLOBAL_TIMESTAMP)=>[VAR_LABEL:VALUE([$CONTEXT_KEY=CONTEXT_VAL]...)](@VARIABLE_TIMESTAMP)|end

Where:

  • USER_AGENT: Mandatory. Contains a characteristic string that allows to identify the application type, operating system, software vendor or software version of the requesting software user agent. Examples: ESP8266/1.0, Particle/1.2

  • DEV_LABEL: Mandatory. The device label to publish values. If it does not exist, Ubidots will create it. Blank spaces are not allowed.
    Examples: Weather-station, living-room

  • DEV_NAME: Optional. The device name to publish values. If not set, the device name will be set using the device label. This parameter is useful when you have as device label your device MAC and you wish to show to final users a friendly name. Blank spaces are not allowed.
    Examples: Street-42-weather-station, living-room-floor-1

  • GLOBAL_TIMESTAMP: Optional. Unix time stamp. If set, any variable value without timestamp will use this one to store values. Must be in milliseconds.If not set, Ubidots will add it automatically with the actual timestamp in UTC.
    Examples: 1534282544356

  • VAR_LABEL: Mandatory. The variable label that will store the dot. If it does not exist, Ubidots will create it.You may send multiple variables splitting them by commas.
    Examples: temperature, wind-speed

  • VALUE: Mandatory. Dot value. You can use a dot to set float numbers.
    Examples: 1.0005, 2

  • CONTEXT_KEY: Optional. If set, you must specify a context value. You can add as many context key as you wish splitting them with a '$' char.
    Examples: lat, lng, name, surname.

  • {CONTEXT_VALU: Optional. The context key value.
    Examples (based on keys above): -6.2, 75.4, "John", "Smith"

  • VARIABLE_TIMESTAMP: Optional. Unix time stamp. If set, the variable will use this one to store dots. This parameter has precedence among the global timestamp. Must be in milliseconds.If not set, Ubidots will add it automatically with the actual timestamp in UTC.
    Examples: 1534282544356

Server Response

  • Valid messages: Ubidots will answer Ok if the request is correct. If multiple values are sent, Ok|OK... strings (one per variable in the request) splitted by pipelines '|' will be returned.

  • Invalid messages: Ubidots will answer ERROR|400 if the message is not valid.

[OK|...]
ERROR|400

Stream Examples

ubidots/1.0|POST|{TOKEN}|weather-station=>temperature:20$day-hour=11$day-minute=23|end
ubidots/1.0|POST|{TOKEN}|weather-station-denver=>temperature:20;weather-station-london=>temperature:20|end