Get Request with JSON


#1

1) Give a description of the problem
Creating a Get request, but no option visible to make it With JSON

2) What is the expected behavior?
Some option available to chose JSON


#2

I believe that’s only available with PUT and POST

Edit: more details here…


#3

You trying to return json that gives a drive time in seconds from google maps API?
For google maps api, that would be:
$timeInSeconds = $response.rows[0].elements[0].duration_in_traffic.value

URL to request would look something like:
https://maps.googleapis.com/maps/api/distancematrix/json?departure_time=now&origins={origin_address}&destinations={destination_address}&key={api_key}

^^ Obviously you’d need variables for “origin_address”, “destination_address”, and “api_key”


#4

So, looking at other examples, users would have a GET URL with JSON (at the end). Is that not need anymore?

image


#5

No, you don’t need to specify JSON… Just a generic GET request.


#6

Specifically, that configuration was possible in the past but it was misrepresentative. The “type JSON” there is supposed to show the format that would be used if you send variables along with the request. For a POST request, your variables would be encoded as {"key1":"value1","key2","value2"}. However, JSON parameters have never been supported or made much sense for GET requests since probably 99% of GET web requests will use form encoding (?key1=value1&key2=value2). Changing it from FORM to JSON had no effect so that field was removed. The server determines what response format to send.