Hi,
I am trying to get a JSON request from the following site: http://api.holfuy.com/live/?s=101&pw=pass&m=JSON&tu=C&su=m/s (example URL you can use for testing).
Here is the api description: http://api.holfuy.com/live/
My code looks like this.
function makeRequest() {
var url = "http://api.holfuy.com/live/"; // set the url
var params = { // set the parameters
"s" => "963",
"pw" => "************",
"m" => "JSON",
"tu" => "C",
"su" => "km/h"
};
var options = { // set the options
:method => Communications.HTTP_REQUEST_METHOD_GET, // set HTTP method
:headers => { // set headers
"Content-Type" => Communications.REQUEST_CONTENT_TYPE_URL_ENCODED},
// set response type
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
};
var responseCallback = method(:onReceive); // set responseCallback to
// onReceive() method
// Make the Communications.makeWebRequest() call
Communications.makeWebRequest(url, params, options, method(:onReceive));
}
Everything works perfectly on the sim, but on my device (Tactix delta with v9) I receive the -400 error.
I don't know a lot about JSON, therefore trouble shooting hasn't gotten me anywhere yet.
I checked the data that comes back from the server. From what I can tell it looks like a proper JSON object, so from my understanding it should work.
Does anyone see what I am overlooking?
Any help would be really appreciated
best regards