-->
Page 1 of 1

http POST request to Google Cloud IoT Core Pub/Sub.

PostPosted: Wed Jul 24, 2019 6:17 am
by Gaurav047
I am working on a project in lua, using the ESPlorer IDE which requires the ESP8266 to send telemetry event to google cloud iot core via http client POST request which must have the similar format as the following:

$ curl -X POST \
-H 'authorization: Bearer <your-jwt-token>' \
-H 'content-type: application/json' \
-H 'cache-control: no-cache' \
--data '{"binary_data": "aGVsbG8K"}' \
'https://cloudiotdevice.googleapis.com/v1/projects/<your-project-id>/locations/<region-name>/registries/iotcore-registry/devices/<device-name>:publishEvent'
{}

Can anyone share a few code snippets as of how to send POST requests including a JWT bearer token for authorization in the header of the POST request?
Thanks