How to upload data to the IBM IoT Platform and Cloudant Database using HTTP APIs?

105 Views Asked by At

I am trying to upload my sensor data to the IBM IoT Platform and Cloudant database using https API. The command I use is

curl -X POST "https://{orgId}.internetofthings.ibmcloud.com:8883/api/v0002/device/types/{deviceType}/devices/{deviceId}/events/{event_name}" -H "Content-Type: application/json" -d "EventPayload" -u 'use-token-auth:{password}'

After I execute the command I am able to upload the data but the data I saw in IBM IoT Platform and Cloudant database is different from the data uploaded. For example, I uploaded EventPayload "{'temperature' : 24}"

I get this in my IoT Platform Event Payload

{
    "type": "Buffer",
    "data": [
        123,
        39,
        116,
        101,
        109,
        112,
        101,
        114,
        97,
        116,
        117,
        114,
        101,
        39,
        32,
        58,
        32,
        50,
        52,
        125
    ]
}

and "payload": "eyd0ZW1wZXJhdHVyZScgOiAyNH0=" at the Cloudant database.

How to upload the data to the IoT Platform and Cloudant database without changing it to a different format?

0

There are 0 best solutions below