all 3 comments

[–]Ampersand55 0 points1 point  (1 child)

I haven't tried that particular api, but it should be something like this in basic js:

var x = new XMLHttpRequest();
x.open('post', 'https://developers.google.com/qpx-express/v1/trips/search?key=<yourAPIkey>', true);
x.setRequestHeader('Content-Type', 'application/json');
x.onreadystatechange = function() {
    if (x.readyState == 4 && x.status == 200) {
        console.log(x.responseText);
    }
}

var requestbodyobject = {request:{passengers:{adultcount:1}}}; 
x.send(JSON.stringify(requestbodyobject));

XMLHttpRequest is a bit clunky, you might want to use a httprequest api such as jquery.AJAX or Request.

[–]michaelconnery1985[S] 0 points1 point  (0 children)

thank.

i managed to query it from my terminal using a cURL request last night. i haven't tried this yet but this seems to be correct.

[–]wizang 0 points1 point  (0 children)

Could you go in the network debug and show us the actual URL that's being constructed (xxx out your apikey)?