My goal is to display a list of nearby restaurants using the Zomato API. I first need the JSON object to get the names of these restaurants. I've already got the API key and I know that the request URL would look like this
https://developers.zomato.com/api/v2.1/search?lat=LATITUDE&lon=LONGITUDE
From the documentation https://developers.zomato.com/documentation, it seems that I have to use something called Curl but I don't know what Curl is.
curl -X GET --header "Accept: application/json" --header "user-key: API key" "https://developers.zomato.com/api/v2.1/search?&lat=LATITUDE&lon=LONGITUDE"
Any help would be appreciated.
I noticed that the Curl contained --header
so I did some research about headers in URLs and added these 2 lines after url.openConnection();
URLConnection urlConnection = url.openConnection();
urlConnection.setRequestProperty("Accept", " application/json");
urlConnection.setRequestProperty("user-key", " "+API_KEY);
And I got what I needed.