Too much useless json data is being fetched when I request a specific country cities by hitting this URL:
http://api.geonames.org/searchJSON?username=ksuhiyp&country=us&maxRows=1000
This returns too many json fields as you can see, question is hot to play with the query to get only city, country name ?
You can try with the additional parameter style=SHORT
http://api.geonames.org/searchJSON?username=ksuhiyp&country=us&maxRows=1000&style=SHORT
The docs says: style, String SHORT,MEDIUM,LONG,FULL (optional), verbosity of returned xml document, default = MEDIUM
Related
Is there any way to retrieve different levels of placeIds from a specific placeId? Like when you load the address components of a place, you get 'country' 'city' 'region' and so on... But you only get the names of the different levels of position. Is it possible to get the placeId of the country, city.... ?
When I am storing data in the database, I need to also store the country placeId, city placeId together with the original placeId. Do not want to store the name of the places in the database, when a lot of places have the same names.
As you noticed there are no place IDs in address components array. You cannot get this information executing only place details request. Developers have already created a feature request in Google issue tracker:
Add place_id in each address_components
You can star it to add your vote. In the meantime the workaround to get place IDs for country and locality consists in executing a reverse geocoding requests for coordinates of the original place ID with result type locality and country.
For example, I have a place ID ChIJEygrJmSYpBIRUXOjvF0QSLw. The details request for this place
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJEygrJmSYpBIRUXOjvF0QSLw&key=MY_API_KEY
gives coordinates 41.3886875,2.130554. Now I can execute additional reverse geocoding request to get place IDs of locality and country:
https://maps.googleapis.com/maps/api/geocode/json?latlng=41.3886875%2C2.130554&result_type=country%7Clocality&key=MY_API_KEY
The last one gives me
place ID ChIJ5TCOcRaYpBIRCmZHTz37sEQ (Barcelona)
place ID ChIJi7xhMnjjQgwR7KNoB5Qs7KY (Spain)
I hope this helps!
I try this query
http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location%3D%2248907%22&format=json
with Weather API yahoo but it returns me NULL...
{"query":{"count":0,"created":"2016-12-14T12:48:16Z","lang":"fr-FR","results":null}}
I want to receive data in JSON to work with
Thanks
The Yahoo API has changed over the last years, right now for the location you need the WOEID, that you can obtain in various ways:
select woeid from geo.places(1) where text='paris,FR'
Writing the previous query in the sample API search in this Yahoo site, where text must be equal to the city and country you desire.
The previous step can be done with a call to the API from your own program, just encode the query.
Clicking 'Change location' in this page and finding your desired city, once the new page loads, the WOEID will be in the browser's URL.
Once you have the code, the call to the api must be done with the following query encoded.
select * from weather.forecast where woeid = 615702 and u='c'
Where woeid is, the number you obtained and u is optional, f value returns Farenheit and c, celsius. But it's worth noting that the first returns imperial units and the second, metric.
Also, in the first link there are examples about limiting what the JSON returns, but you may want to look at the documentation they provide.
I am using the Marketo API V1 to get lead data from a customers Marketo account. I have successfully connected to the API (by going through their documentation).
I can get data for a single lead however it only displays the default data (id, firstName, lastName, email) and I know there are a lot of custom data fields (company, salutation, jobTitle etc.) but this does not show from the API - do you know how I can access this custom data?
Below is the API URL I am using which works fine just not showing all the data I require:
https://<<url>>/rest/v1/leads.json?access_token=<<token>>&filterType=email&filterValues=oliver#test.com
This returns:
{"requestId":"1261b#14f40fc3156","result":[{"id":2755951,"updatedAt":"2015-08-18T10:58:42Z","lastName":"wells","email":"oliver#test.com","createdAt":"2015-06-02T09:36:48Z","firstName":"oliver"}],"success":true}
Thank you very much!
You need to include a parameter, 'fields', which has a comma-separated list of field names to retrieve a given set of fields: http://developers.marketo.com/documentation/rest/get-multiple-leads-by-filter-type/ See example 2, there.
So, starting with the following query, I can pass user input to the Geocode API and return a json object/response with the locations details.
http://maps.googleapis.com/maps/api/geocode/json?address=10010
My problem is I have the following query with component filters with the country set to the US (United States). However, if you enter in a zipcode like this which is returning an area in Russia it still renders the map and sets the marker for the users current location.
http://maps.googleapis.com/maps/api/geocode/json?address=16721**&components=country:US**&sensor=false
Do I need to check the short_name within the returned object in a simple if statement and choose whether to issue a map request or not?
I thought component filters would restrict the user to search within the country specified? Then, return ZERO_RESULTS if there is not a match.
Any input, feedback is welcomed. Thanks!
Remove stars from from country name:
http://maps.googleapis.com/maps/api/geocode/json?address=16721**&sensor=false&components=country:US
I've been looking through the different threads on the Facebook Graph API and displaying the results via JSON. The examples are great but I only want to output the info for a particular album not loop through various results.
Here is a link to the Coca-Cola Wall Photos album. https://graph.facebook.com/99394368305
What I would like to do is display the Name of the Album and the Link.
Any help is much appreciated!
You can choose only the fields you want by specifying the fields query parameter:
https://graph.facebook.com/99394368305/?fields=name,link
From http://developers.facebook.com/docs/reference/api/#reading:
Selection
By default, most object properties are returned when you make a query. You can choose the fields (or connections) you want returned with the "fields" query parameter. For example, this URL will only return the id, name, and picture of Ben: https://graph.facebook.com/bgolub?fields=id,name,picture
You can also request multiple objects in a single query using the "ids" query parameter. For example, the URL https://graph.facebook.com?ids=arjun,vernal returns both profiles in the same response.