Reputation: 97
I'm working on gathering data from all of my sites on places I've been for a personal project. I did my data export from Yelp, but the list of reviews only has the business name, not the business address. I can get the business locations from the check-ins, but I didn't always check in to the places I reviewed. I'm wondering if anyone has used the Yelp API to get a list of businesses with addresses (or at least city and state) based on a reviewer (in this case - me)?
I did some browsing of the Yelp API docs, but didn't see much on reviewer unless you were looking at a specific business.
Upvotes: 0
Views: 452
Reputation: 1960
Yes, you are right you cannot see business location by review. You can make multiple search requests for each location you reviewed and loop results to find the business name, and its address.
The search endpoint documentation is here: https://docs.developer.yelp.com/reference/v3_business_search
curl --request GET \
--url 'https://api.yelp.com/v3/businesses/search?term=pizza&limit=20&location=Los+Angelis,CA' \
--header 'accept: application/json'
{
"businesses": [
{
"alias": "golden-boy-pizza-hamburg",
"categories": [
{
"alias": "pizza",
"title": "Pizza"
},
{
"alias": "food",
"title": "Food"
}
],
"coordinates": {
"latitude": 41.7873382568359,
"longitude": -123.051551818848
},
"display_phone": "(415) 982-9738",
"distance": 4992.437696561071,
"id": "QPOI0dYeAl3U8iPM_IYWnA",
"image_url": "https://yelp-photos.yelpcorp.com/bphoto/b0mx7p6x9Z1ivb8yzaU3dg/o.jpg",
"is_closed": true,
"location": {
"address1": "James",
"address2": "Street",
"address3": "68M",
"city": "Los Angeles",
"country": "US",
"display_address": [
"James",
"Street",
"68M",
"Los Angeles, CA 22399"
],
"state": "CA",
"zip_code": "22399"
},
"name": "Golden Boy Pizza",
"phone": "+14159829738",
"price": "$",
"rating": 4,
"review_count": 903,
"transactions": [
"restaurant_reservation"
],
"url": "https://www.yelp.com/biz/golden-boy-pizza-hamburg?adjust_creative=XsIsNkqpLmHqfJ51zfRn3A&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=XsIsNkqpLmHqfJ51zfRn3A"
}
],
"region": {
"center": {
"latitude": 37.76089938976322,
"longitude": -122.43644714355469
}
},
"total": 6800
}
However, replacing the term and location for each of your past reviews is not ideal and you need to make multiple requests.
Upvotes: 0