[TC] Gaming Forums

Full Version: Getting specific user's location via API
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
SOLUTION: See post #10 Smile

Hi,
I'm struggling to get the location of a specific user atm. I realise that I can get the location of users, but that is for everyone in that server. Example:

Quote:GET https://api.tc-gaming.co.uk/citydriving/...server=all

returns something like this:

Quote:[
{
"id": 11969,
"countryCode": "GB",
"username": "Garypants",
"nickname": "^1[TC]^7\u203aCarl\u2039",
"money": 259473,
"distance": 156889746,
"trip": 34846,
"bonus": 22,
"lastCar": "XRT",
"lastPosition": "^3Medical Centre^8",
"server": "^7One"
},
...
]

But is there a way to lookup one person, like you can with profile lookup, and get the location? If not, is there a way to use the global JSON file to get a specific user?

I am coding in C#. Hope this made sense Smile

Any help would be greatly appreciated Biggrin
Location as in... where they are on the server? Or physical location in which they're playing from?
Sorry, I should've made this clear - the location in-game (so 'lastPosition') Smile
There are some ways, but I would need to know what you intent to do with it.
i.e do you need info from players being online or even when they gone offline.
What needs done is for the local insim program to know what road name they are on so it can then be displayed on the screen
(2018-05-16 18:30)Jack Wrote: [ -> ]Sorry, I should've made this clear - the location in-game (so 'lastPosition') Smile

https://apidocs.tc-gaming.co.uk/citydriv...ers-online

lastPosition field does it for everyone online, I don't think you can for someone offline
(2018-05-17 05:17)Chuck Wrote: [ -> ]There are some ways, but I would need to know what you intent to do with it.
i.e do you need info from players being online or even when they gone offline.

For everyone online.

(2018-05-17 08:48)Adorable Wrote: [ -> ]
(2018-05-16 18:30)Jack Wrote: [ -> ]Sorry, I should've made this clear - the location in-game (so 'lastPosition') Smile

https://apidocs.tc-gaming.co.uk/citydriv...ers-online

lastPosition field does it for everyone online, I don't think you can for someone offline

I did see this, but wasn't sure if you could do it for only a single person like you can with the profile lookup. If you can't, I can probably do it other ways (e.g. jump down lines)
I am wondering why you are specifically asking for the location of just one user.
Like I stated it is to display the location of the drivers location in real time. I’m aware that this can be done
If it's really just about one particular user you can do it this way:
https://api.tc-gaming.co.uk/json/<lowercase username>.json
(2018-05-18 07:55)J.Walsh Wrote: [ -> ]Like I stated it is to display the location of the drivers location in real time. I’m aware that this can be done
Could be done, except the API limits you to 720 queries per hour, which would cause problems if you wan't to see the location in real time.
Things u need in realtime should be provided by your own Insim anyway. I still dont know what u need the location for, as it's also very imprecise. "Autobahn North" on Kyoto covers pretty much half of the map. On a side note, why don't u simply buy a locator? It does exactly what you want Wink
(2018-05-18 08:03)Chuck Wrote: [ -> ]If it's really just about one particular user you can do it this way:
https://api.tc-gaming.co.uk/json/<lowercase username>.json

I completely forgot about this page. Thanks Chuck!
Reference URL's