Are there any best practices or any way to help a developper understand the true reason why a makeWebRequest call fails during the background parsing? or even better where in the JSON response the parser gives up?
I read all the posts on the topic and could not find anything that would help me debug the problem. I'm going crazy trying to understand what can go wrong!!!
I'm using exactly the same makeWebRequest call, with exactly the same options (only the url changes to address a different resource):
var params = null;
var options = {
:method => Comm.HTTP_REQUEST_METHOD_GET,
:responseType => Comm.HTTP_RESPONSE_CONTENT_TYPE_JSON,
:headers=> {
"Content-Type" => Comm.REQUEST_CONTENT_TYPE_JSON,
"Accept" => "application/json"
}
};
Comm.makeWebRequest(url, params, options, method(:onResponse));
Server side is pretty happy with the request, I did try to replace the makeWebRequest by an openWebPage to get a dump of what was coming back from the server. The JSON returned seems quite OK and well structured (see JSON response below), yet it always fails the parsing step with an error code -400:
{
"collection": {
"version":"1.234.5",
"href":"api.test.com/.../time_zones",
"rel":"time_zones",
"links": [
{
"rel":"root",
"href":"https://api.test.com/v1/"
},
{
"rel":"self",
"href":"https://api.test.com/v1/time_zones"
}
],
"queries": [
{
"rel":"search",
"href":"https://api.test.com/v1/time_zones/search",
"data": [
{
"name":"id",
"value":null
},
{
"name":"user_id",
"value":null
}
]
}
]
}
}
As I said earlier, I'm able to get a lot more complicated responses from the same server to be parsed with success.
Can anyone share any insight as to why the background parser may not like the JSON response above?
Thanks in advance for your help! I'm really stuck!