I purchased a board which has the code written in Processing, I want to use GET Method to upload data using URL to my server, but the board has only post request following code:
Could you please help me to transform into GET Method?
Thanks!
int thingSpeakPostTime = millis() + 10000;
void updateMQTT()
{
if(millis() > thingSpeakPostTime)
{
PostRequest post = new PostRequest("https://DOMAIN/api/api_loc.php?imei=X&dt=X&lat=X&lng=X&altitude=X&angle=X&speed=X&loc_valid=1");
post.send();
println("Reponse Content: " + post.getContent());
println(post);
}
}
Usually if the server only accepts post methods, then you need to create a post request in your code. If you send a GET request and the server does not know how to process it, you will get an error in the response, maybe a 500 error saying something like the server doe snot know how to handle that request.
You can attach data in the body of a POST request. You will need to check the API and documentation provided by the app running in the server. If need more help, do not hesitate to share a link to their docs here.