Implementing cURL using Arduino IDE

Hello, I’m working on a project where I’m building some IoT devices for a university project. I have to implement cURL and I’m running into some trouble translating the code to C in the Arduino IDE. I have not been able to connect my devices to my API and I have a hunch it might have to do with the HTTP code I am using to match the cURL. I am using the Adafruit Huzzah ESP8266 and I am using the ESP8266WiFi and ESP8266HTTPClient libraries as well. Any help would be appreciated. Thank you!

Here are the lines I’m trying to implement:

curl -X POST \ https://<host>:<port>/api/v1/provision/devices/register \

-H 'Authorization: Bearer <JWT_TOKEN>' \

-H 'Content-Type: application/json' \

-H 'X-Device-ID: ABC-1235686759' \

-d '{ "type": "ABC", "serialNumber": "12345", "uuid":"1235686759" }'

Here is my code for the device:

HTTPClient http; //Declare object of class HTTPClient

http.begin(""); //Specify request destination

http.addHeader("Authorization:", "Bearer <JWT_TOKEN>");

http.addHeader("x-Device-ID:", "ABC-1235686759");

payloadJ= jwt.encodeJWT(holder);//payload signed with public key

int httpCode = http.POST(payloadJ); //Send the request

String payloadS = http.getString(); //Get the response payload

Serial.println(httpCode); //Print HTTP return code

Serial.println(payloadS); //Print request response payload

http.end(); //Close connection

Fetching data from https:// sites requires extra coding. See thread at ESP8266 HTTPClient Library for HTTPS - Programming Questions - Arduino Forum for more info.

Another tip is to use a site like to see what your request actually looks like at the far end.