Closed TomasNilsson closed 9 years ago
Comment by tomas-nilsson Monday Mar 02, 2015 at 03:00 GMT
How to get list of nearby users from server:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Authorization: Token token="wsjdhkjhksfdjhk"' -X GET http://localhost:3000/api/users/nearby?distance=30
The unit for the distance is km. If the distance parameter is not included the default value is 30 km.
The response looks like this:
[{
"id":2,
"username":"test",
"distance":0.0,
"bearing":45.0,
"friend":false,
"song":{
"name":"Firestone",
"artist":"Conrad, Kygo",
"uri":"spotify:track:2sNvitW3TxiTeC9xT9f2ZZ",
"image_url":"https://i.scdn.co/image/4e3a6b099bb58c6da54502a516b3aea2c0a7b2a8"
}
},{
"id":1,
"username":"manutdtomas",
"distance":11.674049141313997,
"bearing":225.0,
"friend":true,
"song":{
"name":"Jealous",
"artist":"Nick Jonas",
"uri":"spotify:track:2woCw59DHRIb1vcyQ2a7Ca",
"image_url":"https://i.scdn.co/image/db3e62faaf9f712ca2239df67457909fe1d67090"
}
}]
Issue by tomas-nilsson Sunday Feb 15, 2015 at 05:40 GMT Originally opened as https://github.ucsb.edu/tomas-nilsson/SpotiTraceApp/issues/4