Max length of JSON response?

I'm replying to HermoT in a new thread, so as not to hijack the other, fixed issue.

Does anyone know what the max length of the json response is and whether this is the same in iOS and Android?
I currently am hitting a 400 error with my makeWebRequest when the phone is Android, but I never get the issue when it is iPhone.

I believe I have the latest version of GCM Android as I installed a fresh copy of it it last night on my wife's phone to investigate the 400 error.
The url is exactly the same as it is when sending to an iPhone, so I assume it has to be a difference in how GCM on Android handles the response compared to iPhone.

The issue happens on the newer type of devices: first reported by a Chronos user, but also reproduced by me on 935 and f5s. So I don't think it is an object count issue and it is giving 400 error, not crashing, so is different from the original issue posted here.

To me 400 means a bad request. So could it be that the default options / headers for the request are not handled correctly on Android?

I have the code as follows:

var options = {

:methods => Comm.HTTP_REQUEST_METHOD_GET,

:responseType => Comm.HTTP_RESPONSE_CONTENT_TYPE_JSON

};

Comm.makeWebRequest(url, null, options, method(:onReceive));



Another thing: My url contains all the querystring parameters. I am not using the params dictionary for this purpose. Could this also be an issue?


My METAR/TAF widget regularly pulls in tightly packed (minimal hashes, single dimension arrays) JSON that is around the 1000 byte mark. If you let me know what the size of your 400-error response is, I'll doctor a special response to mimic that size for my app on Android and see if the same thing happens.

Cheers,
Douglas
  • Hey,

    I was able to find out that it should be 16k max. have you tried using the params dictionary instead? You should be fine unless there is something going on with GCMA.

    Thanks,
    -Coleman
  • I'm replying to HermoT in a new thread, so as not to hijack the other, fixed issue.



    My METAR/TAF widget regularly pulls in tightly packed (minimal hashes, single dimension arrays) JSON that is around the 1000 byte mark. If you let me know what the size of your 400-error response is, I'll doctor a special response to mimic that size for my app on Android and see if the same thing happens.

    Cheers,
    Douglas


    Hi Douglas!

    Thanks and sorry for posting in the wrong thread!

    I managed to solve my issue:
    The issue is as follows:

    According to the worldtides api documentation, the following url is used to retrieve tidal extremes:

    /api?extremes&key=<userkey>

    Note the lack of an assignment operator for extremes param.
    This was acceptable by iOS GCM, but not Android. I guess Android is much more stricter.

    So I fixed it by just adding the = as follows:

    /api?extremes=&key=<userkey>

    or

    var params = {"extremes"=>"", .....};
  • Former Member
    Former Member over 7 years ago
    This was acceptable by iOS GCM, but not Android. I guess Android is much more stricter.

    So I fixed it by just adding the = as follows:

    /api?extremes=&key=<userkey>

    URL parameters without a corresponding value should be valid. I've created a ticket to investigate this more, but good to see you have a fix that works.
  • URL parameters without a corresponding value should be valid. I've created a ticket to investigate this more, but good to see you have a fix that works.

    Thanks Kevin!
  • Hey,

    I was able to find out that it should be 16k max. have you tried using the params dictionary instead? You should be fine unless there is something going on with GCMA.

    Thanks,
    -Coleman


    Thanks Coleman, yes I posted the solution for both the url and the params dictionary. At first I didn't know if a param without a value can be specified in the dictionary, but it is all sorted now!
  • URL parameters without a corresponding value should be valid. I've created a ticket to investigate this more, but good to see you have a fix that works.


    Kevin.ConnectIQ Can you please follow up what happened to this bug?
    I assisted another user yesterday, and it seems we got the same issue on iOS where it will return -201 when you have an empty string value for a parameter:

    {"extremes"=>""} causes the makewebrequest to return -201 when paired with an iOS device.

    If I put in something like

    {"extremes"=>"1"} then it works.

    The web service only expects the extremes parameter without a value, like

    ?extremes&otherParam=1

    Luckily it ignores the value part.

    But still, it should be possible to specify the parameter without a value in the params dict.