We are evaluation algolia places API and want to use it to find the address of sights. As an example, we want to find "Reichstagsgebäude, Berlin" which works and we get the correct response:
{
"query": "Reichstag, Berlin",
"suggestion": {
"name": "Reichstagsgebäude",
"administrative": "Berlin",
"city": "Berlin",
"country": "Deutschland",
"countryCode": "de",
"type": "address",
"latlng": {
"lat": 52.5186,
"lng": 13.3761
},
"postcode": "10557",
"highlight": {
"name": "Reichstagsgebäude",
"city": "<em>Berlin</em>",
"administrative": "<em>Berlin</em>",
"country": "Deutschland"
},
"value": "Reichstagsgebäude, Berlin, Berlin, Deutschland"
}
}
But how to get the real address of the Building with the Street name and Street Number included, which should be "Platz der Republik 1"
Currently, Algolia Places has street-level precision. We currently only have data for house-level precision (i.e., street name and street number) for France. This is an area we are actively looking to improve, but the data is still in process.
Related
maybe I'm blind but I can't find a documentation how I post an address to an address field on a Sharepoint list via REST.
I always receive an "invalid Request" error. If I remove the address part of my JSON I'm able to fill out the other fields w/o problems. Just struggling with the address.
My request looks like that:
POST:
https://graph.microsoft.com/v1.0/sites/test.sharepoint.com,{siteid}/lists/{listid}/items/
Data:
{
"__metadata": {
"type": "SP.Data.listname.ListItem"
},
"fields":{
"Title": "API Test Project",
"Projekt_ID": "25",
"Typ": "Hinzugefügt",
"MengeNeu": "50/40/330",
"PosNr": "5/4/1",
"Adresse": {
"address": {
"city": "city",
"countryOrRegion": "DE",
"postalCode": "55512",
"state": "test",
"street": "test street 3"
},
"coordinates": {
"latitude": 44.72789001464844,
"longitude": 10.132317543029785
},
"displayName": "Test",
"locationUri": "https://www.bingapis.com/api/v6/localbusinesses/xxx?setLang=de",
"uniqueId": "https://www.bingapis.com/api/v6/localbusinesses/xxx?setLang=de"
}
}
}
Thanks
I want to get logged in user's Check-ins along with the category of the place he has checked-in.
I tried to fetch the user likes and their categories and this is what worked for me - "/me/likes?fields=category"
Following is the response returned:
{
"data": [{
"name": "11 East Street Cafe",
"category": "Restaurant/Cafe",
"id": "94871278677"
},{
"name": "ABC DEF",
"category": "Politician",
"id": "177526890164"
}],
"paging": {
"cursors": {
"before": "NDkyMzg4OTc3NTYyMjk3",
"after": "MTc3NTI2ODkwMTY0"
}
}
}
For check-ins, I tried "/me/feed?with=location&fields=place,story" and it returns the checked in places list. It returns me following:
{
"data": [{
"place": {
"id": "117586118328311",
"name": "Carraba's",
"location": {
"city": "Ellicott City",
"country": "United States",
"latitude": 39.27153726574,
"longitude": -76.800542073324,
"state": "MD",
"zip": "21043"
}
},
"story": "ABC was at Carraba's.",
"id": "1533836476934935_1546360939015822"
}, {
"place": {
"id": "876737405718973",
"name": "Chipotle Mexican Grill",
"location": {
"city": "Baltimore",
"country": "United States",
"latitude": 39.2866707,
"longitude": -76.6196671,
"state": "MD",
"street": "300 W Pratt St",
"zip": "21201"
}
},
"story": "Aadya Extentia was at Chipotle Mexican Grill.",
"id": "1533836476934935_1546360502349199"
}],
"paging": {
"next": "https://graph.facebook.com/v2.5/1533836476934935/feed?fields=place,story&wi…WzlgXDpe8ZCV8kHWcO2aNxlARSpwIZByS9OWkU8VC3nj2E3VoiLkJNpy2ESOI1R7fHIOJQZDZD"
}
}
But it does not return the category of checked-in place. i.e. I want know if it is a restaurant, museum or stadium, etc.
How do I do it?
Thanks.
You can do this using Field Expansion:
/me/feed?with=location&fields=place{name,category},story
Edit: Looks like this is working for API version <= 2.4 only, but not any more with v2.5.
Edit #2: I filed a bug report to ask if this was deliberately removed, or if it is a bug. https://developers.facebook.com/bugs/1550467468600884/
Even though a Place is a Page, I can't successfully retrieve the category field through Field Expansion...
This can be done with a batch request, by using the output of the first query as input for the second query:
curl \
-F 'access_token={USER_ACCESS_TOKEN}' \
-F 'include_headers=false' \
-F 'batch=[{ "method":"GET","name":"get-places","relative_url":"me/feed?with=location&fields=place{id,name,location},story&limit=100", "omit_response_on_success": false },{"method":"GET","relative_url":"?ids={result=get-places:$.data.*.place.id}&fields=id,name,category"}]' \
https://graph.facebook.com
See
https://developers.facebook.com/docs/graph-api/reference/place/
https://developers.facebook.com/docs/graph-api/making-multiple-requests/
I know from the documentation of the instagram API that instagram has facebook locations mapped so you can search and get the location detail from instagram via facebook place id i.e.
https://api.instagram.com/v1/locations/search?facebook_places_id=273471170716&access_token=[ACCESS-TOKEN]
As you can see I am retreiving the location detail via facebook place id.
But in my scenario, what I want is to get facebook place id using instagram id from the instagram location detail. Below is what I mean:
I have got the instagram location id and can get the detail of the place using the following:
https://api.instagram.com/v1/locations/2862169?access_token=[ACCESS-TOKEN]
But the above call only returns the location name and geographic co-ordinates. Whereas I want the Facebook place id of the location as well. Is there any way for me to get the facebook place id from the instagram as well?
I have checked their documentation on Location endpoints (https://instagram.com/developer/endpoints/locations/) and wasn't able to find any relevant information.
The reason why I want that is, I need to get the location detail such as category etc as well which instagram API doesn't provide, so I plan on using this retrieved facebook place id on facebook graph API to retrieve this additional location details.
I think you can only use the Facebook Graph API search for this. Therefore, you can use the output from the Instagram API for latitude, longitude and name to construct a Graph API call which returns you a list of matching Facebook Place Pages.
If the Instagram location id is 788029 for example, the API will return the following JSON:
{
"id": "788029",
"latitude": 48.858844300000001,
"longitude": 2.2943506,
"name": "Eiffel Tower, Paris"
}
So, if you take this result and use the data to construct a Facebook Graph API search url, it will result in something like this:
https://graph.facebook.com/search?q=Eiffel%20Tower,%20Paris&type=place¢er=48.858844300000001,2.2943506&distance=100&limit=3&access_token={app_access_token}
You can choose the distance as well as the limit as you desire. If you set limit=1 you will only receive the place which Facebook deems to be the best match. Replace {app_access_token} with an actual App Access Token.
The Facebook response will be something like
{
"data": [
{
"category": "Local business",
"category_list": [
{
"id": "276651312419490",
"name": "Monument"
}
],
"location": {
"street": "",
"city": "Paris",
"state": "",
"country": "France",
"zip": "75007",
"latitude": 48.858385562198,
"longitude": 2.2944861654879,
"located_in": "141184112585566"
},
"name": "Level 2 Eiffel Tower, Paris",
"id": "380503552017025"
},
{
"category": "Local business",
"category_list": [
{
"id": "186825111351005",
"name": "Tourist Attraction"
}
],
"location": {
"street": "",
"city": "Paris",
"state": "",
"country": "France",
"zip": "",
"latitude": 48.858205346341,
"longitude": 2.2944900587791
},
"name": "Eiffel Tower Sommett, Paris, France",
"id": "1458706024363987"
},
{
"category": "Restaurant/cafe",
"category_list": [
{
"id": "168976549819329",
"name": "French Restaurant"
}
],
"location": {
"street": "",
"city": "Paris",
"state": "",
"country": "France",
"zip": "75007",
"latitude": 48.858532957713,
"longitude": 2.2941094631632,
"located_in": "141184112585566"
},
"name": "58 Tour Eiffel (officiel)",
"id": "148894855169991"
}
],
"paging": {
"next": "https://graph.facebook.com/v2.2/search?limit=3&type=place&q=Eiffel Tower, Paris¢er=48.858844300000001,2.2943506&distance=100&offset=3&__after_id=enc_AdCYS3bVKOc29JFMrqlsouSZCvBxUTYZC7nHvqDHKAiBNrOs2ehUIaOsJ2wL9TxF9KOfgGmqEPOaLwotDM4pIUqyFf"
}
}
See
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#search
https://instagram.com/developer/endpoints/locations/
Currently when I would like to retrieve address for coordinates I make following request as an example:
GET http://api.tiles.mapbox.com/v3/examples.map-zr0njcqy/geocode/-114.0701,51.0495.json
I get address information up to the street level but NO house number. Is there way to retrieve it as well? I think it's such an obvious need and cannot think of any problems extracting this date when you already extracted the rest.
{
"attribution": {
"mapbox-places": "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox © OpenStreetMap</a> <a class='mapbox-improve-map' href='https://www.mapbox.com/map-feedback/' target='_blank'>Improve this map</a>"
},
"query": [
-114.0701,
51.0495
],
"results": [
[
{
"id": "street.31973701",
"lat": 51.0476559,
"lon": -114.0703042,
"name": "3 St SW",
"type": "street"
},
{
"bounds": [
-114.36183200000002,
50.84361600000001,
-113.87432100000002,
51.217528999999985
],
"id": "mapbox-places.10008775",
"lat": 51.03095,
"lon": -114.108491,
"name": "Calgary",
"type": "city"
},
{
"bounds": [
-120.00138351899996,
48.99667665000002,
-110.004763853,
60.00042158400004
],
"id": "province.2553712403",
"lat": 54.872006,
"lon": -115.003552,
"name": "Alberta",
"type": "province"
},
{
"bounds": [
-141.00275000000013,
40.043430830999895,
-47.69751888999983,
86.45371111000011
],
"id": "country.1833980151",
"lat": 76.304456,
"lon": -105.801333,
"name": "Canada",
"type": "country"
}
]
]
}
#rbrundritt is correct.
Most mapping applications (Google, Bing, etc) merely interpolate the location when given a street address. They are aware of the starting and ending address on a given block and then make an educated guess as to where the address you are search for is located on that block based on that. They don't actually store the outlines and the addresses of each property.
When i tried to get the current location of a user via FQL, Graph API returned something like this;
{
"data": [
{
"current_location": {
"city": "Izmir",
"state": "Izmir",
"country": "Turkey",
"zip": "",
"id": 107968765903327,
"name": "İzmir, Turkey"
}
}
]
}
Using the Graph ID above, i checked the location information from https://graph.facebook.com/107968765903327 and this time i get more data about the city;
{
"id": "107968765903327",
"name": "\u0130zmir, Turkey",
"link": "http://www.facebook.com/pages/\u0025C4\u0025B0zmir-Turkey/107968765903327",
"likes": 178460,
"category": "City",
"is_published": true,
"is_community_page": true,
"description": "\u003Cp>\u003Cb>Izmir\u003C/b> is a large ...",
"location": {
"latitude": 38.4072,
"longitude": 27.1503
},
"checkins": 9059,
"talking_about_count": 238710
}
But, as you see, there is no chance for the country code with these options. Any other suggestions?
reverse geocode could help
see https://developers.google.com/maps/documentation/geocoding/