Ashwin Kanjariya
Ashwin Kanjariya

Reputation: 1059

Google Place search API with pageToken returns same record

I'm listing out restaurants, bars and pubs near by I used "pageToken" as I need more place records.

I faced two issues as

1 My URL is not accepting | 'pipeline' symbol.

I tried encoding URL but its not working so Just encode | as "%7C" is this correct way?

2 I just tied to list outs only restaurant and use next_page_token while calling next time the API to load more records.

My URL is something like

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=19.0176147,72.8561644&rankby=distance&type=restaurant&key=[MY_APP_KEY]&pageToken=CpQCCQEAAPqnEctK9cCPZtPWY8NnnBSyzCwsmO_MsTZBaIUeEkO6g_7rsw97tY-bMsBY0d0Rjw61zD-Peaos4wMVZTe7TrZhB-GVfpr6ya847qB0t1C_2Qgxe3Abur1YmRW_fop0Ro5bwIkxOjMI2Gh19D1IYGPOZ7qqv1oM3B7P4lHZ59yFwXEhMbMZUvQSiuVyoDKQ-FXQB9FMCGkGkbllH9ZzIm-38_XG4ZsFMOYKHhdhp3hkCiLVc8SwLO01t-Bq1emptTQfHUUtXXcCWEFCFClpkJlw0rRnW2fRXuxEy25nFZlqrNxHgcifA6v_xq7Jfb5J5FDTCT4FSurAa1MUXYCPW3fPri-7n9CpZwzZDp7wUOUPEhBByQSF6FAegW_gFyc4Q9PqGhSqewBPNa7pLMTWLFJR94IfhPPqpg

But its returning same records on every request, I have verified that pageToken is getting changed in every request.

Can you please let me know where I made mistake?

Upvotes: 1

Views: 617

Answers (1)

Kushal Panchal
Kushal Panchal

Reputation: 271

You are passing wrong key pageToken. Change it to pagetoken and it will work.

Please refer this link for further information: https://developers.google.com/places/web-service/search

Upvotes: 5

Related Questions