Announcement

Collapse
No announcement yet.

makeWebRequest: -201 response when sending a POST request containing a JSON array

Collapse
X
  • Time
  • Show
Clear All
new posts

  • #16
    For clarity, my code looks like this:

    Code:
    var params = {
        "query" => "query my_query($lat: Float!, $lon: Float!, ...",
        "variables" => {
            "lat" => lat,
            "lon" => lon,
            "maxdistance" => maxdistance,
            "maxstops" => maxstops,
            "maxdep" => maxdepartures,
        }
    };
    var options = {
        :method => Communications.HTTP_REQUEST_METHOD_POST,
        :headers => {
            "Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON,
        },
        :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
    };
    Communications.makeWebRequest(API_URL, params, options, callback);
    For clarity, I've manually truncated the query as it's a bit over 500 bytes long (in case that would make a difference)

    Comment

    Working...
    X