POST to Vägverket API

Hi,

I want to POST a question to Vägverket API, but I can not figure out to write the request
http://api.trafikinfo.trafikverket.se/Console

The request shall be






Deviation.Id
Deviation.Header
Deviation.IconId
Deviation.Geometry.WGS84

and the URL http://api.trafikinfo.trafikverket.se/v1.3/data.json

I used a simple code, but I realise that I am not even able to get the " sign of the request in the string to be used in http.POST("XXXX")

Can any one please guide me to how shall this be written??

#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
const char* ssid = "xxx";
const char* password = "yyy";
 
void setup() {
 
  Serial.begin(115200);                                  //Serial connection
  WiFi.begin(ssid, password);   //WiFi connection
 
  while (WiFi.status() != WL_CONNECTED) {  //Wait for the WiFI connection completion
 
    delay(500);
    Serial.println("Waiting for connection");
 
  }
 
}
 
void loop() {
 
 if(WiFi.status()== WL_CONNECTED){   //Check WiFi connection status
 
   HTTPClient http;    //Declare object of class HTTPClient
 
   http.begin("http://api.trafikinfo.trafikverket.se/v1.3/data.json");      //Specify request destination
   http.addHeader("Content-Type", "text/plain");  //Specify content-type header
 
   int httpCode = http.POST("XXXX");   //Send the request
   String payload = http.getString();                  //Get the response payload
 
   Serial.println(httpCode);   //Print HTTP return code
   Serial.println(payload);    //Print request response payload
 
   http.end();  //Close connection
 
 }else{
 
    Serial.println("Error in WiFi connection");   
 
 }
 
  delay(30000);  //Send a request every 30 seconds
}

Write the double quotes in the XML content as ", so they are escaped and not interpreted by the compiler but used as part of the string.

Thanks, now I at least mange to compile it, but it do not work - how do I POST the XML? I thought it was just to put a long text file in the "XXXX" - but this did not work at all.
int httpCode = http.POST("XXXX"); //Send the request

how do I POST the XML?

That depends on the API used but if it's at least partly standards conforming the content type should be text/xml and not text/plain. It might also be necessary to tell the server what type of data you're able to process but that is not necessary for every API.

Thanks, it worked with text/xml