问题
What are requirements for handler of Push Callback of Foursquare API?
- What http verb 4sq uses to make a call ?
- What parameters/information does it send to my server ?
- What my server should reply ?
Surprisingly I don't see answers on these questions at https://developer.foursquare.com/overview/
Update:
Well, since nobody replied I decided to insert to DB whatever comes to my end-point. Turned out callbacks never reach my server. Foursquare Push Console says my server returns 502 Bad Gateway
which it doesn't. Is it possible that Foursquare backend ignores port number in callback URL ? My url looks like this
https://api.hostmane.com:8443/api/handle_4sq_push
回答1:
Well, seems like Foursquare doesn't have anyone from API team responsible for communicating with developers. I sent them email as well but nobody replied.
So here are my findings:
- Foursquare backend doesn't use port number from call-back url. I think it's a bug. So make sure you're listening on port 443.
- It's HTTP POST with form-url-encoded parameters.
- There are three parameters passed:
checkin
(this object in json),user
(this object in json),secret
(Push Secret from settings of your app). - Your server is supposed to reply with error code 200.
来源:https://stackoverflow.com/questions/17604929/what-are-requirements-to-handler-of-push-callback-of-foursquare-api