Jump to content

[TruckersMP API] Possibile bug in player search via API


Recommended Posts

Hi,

 

i'm integrating the player search via TruckersMP api in my app and i've encountered a strange case:

 

Searching for player id 1168240 on https://api.truckersmp.com/v2/player/1168240, it returns the steamID64 as 76561198347861090 but the correct one is 76561198347861093 .

 

Can you help me to understand? :D

 

Thank you!

 

 

Trucky - The Virtual Trucker Companion app

Owner and Lead Developer

 

spacer.png

 

Mobile App, In-Game Overlay, Dispatcher, Automatic Recording on collision, In-Game Radio streaming, Discord Rich Presence Integration

 

Download Trucky on your mobile device - Install Trucky for Windows - Trucky Website

 

 

Link to comment
Share on other sites

It seems to be related to steamID64 dimension ( https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER )

 

from Chrome (parsed with JSON extension)

{

error: false,

response: {

id: 1168240,

name: "hristospasoff",

avatar: "https://static.truckersmp.com/avatars/1168240.1493059488.jpg",

joinDate: "2016-11-26 18:37:04",

steamID64: 76561198347861090,

groupName: "Player",

groupID: 1,

permissions: {

isGameAdmin: false,

showDetailedOnWebMaps: false

}}

}

 

The same from react-native, when parsing with JSON.parse 76561198347861093 becomes 76561198347861090 . It's funny :)

 

from Chrome (real response)

 

{"error":false,"response":{"id":1168240,"name":"hristospasoff","avatar":"https:\/\/static.truckersmp.com\/avatars\/1168240.1493059488.jpg","joinDate":"2016-11-26 18:37:04","steamID64":76561198347861093,"groupName":"Player","groupID":1,"permissions":{"isGameAdmin":false,"showDetailedOnWebMaps":false}}}

 

from Chrome - Incognito mode

 

{"error":false,"response":{"id":1168240,"name":"hristospasoff","avatar":"https:\/\/static.truckersmp.com\/avatars\/1168240.1493059488.jpg","joinDate":"2016-11-26 18:37:04","steamID64":76561198347861093,"groupName":"Player","groupID":1,"permissions":{"isGameAdmin":false,"showDetailedOnWebMaps":false}}}

 

from Firefox

 

{"error":false,"response":{"id":1168240,"name":"hristospasoff","avatar":"https:\/\/static.truckersmp.com\/avatars\/1168240.1493059488.jpg","joinDate":"2016-11-26 18:37:04","steamID64":76561198347861093,"groupName":"Player","groupID":1,"permissions":{"isGameAdmin":false,"showDetailedOnWebMaps":false}}}

 

From ARC (Chrome extension to execute web request)

 

api_arc.JPG.5807fcc662ece86cf5194d7a230b9155.JPG

 

I think the fix is to return steamID64 as string and not as integer or add a property as string with same value.

 

Trucky - The Virtual Trucker Companion app

Owner and Lead Developer

 

spacer.png

 

Mobile App, In-Game Overlay, Dispatcher, Automatic Recording on collision, In-Game Radio streaming, Discord Rich Presence Integration

 

Download Trucky on your mobile device - Install Trucky for Windows - Trucky Website

 

 

Link to comment
Share on other sites

^Good catch, we'll make sure to fix that issue in the future. (yay for assuming 64bit integers was common these days...)

 

 

edit:

If another developer comes by, check API-8

Link to comment
Share on other sites

Thank you @Tuxy Fluffyclaws

Trucky - The Virtual Trucker Companion app

Owner and Lead Developer

 

spacer.png

 

Mobile App, In-Game Overlay, Dispatcher, Automatic Recording on collision, In-Game Radio streaming, Discord Rich Presence Integration

 

Download Trucky on your mobile device - Install Trucky for Windows - Trucky Website

 

 

Link to comment
Share on other sites

  • 4 weeks later...

Hi @Tuxy Fluffyclaws ,

 

do you have news about steamID64 property issue? JSON responses for some call are still broken.

 

Fyi, JSON parsing on node.js works correctly with this: https://www.npmjs.com/package/json-bigint 

Edited by dowmeister

Trucky - The Virtual Trucker Companion app

Owner and Lead Developer

 

spacer.png

 

Mobile App, In-Game Overlay, Dispatcher, Automatic Recording on collision, In-Game Radio streaming, Discord Rich Presence Integration

 

Download Trucky on your mobile device - Install Trucky for Windows - Trucky Website

 

 

Link to comment
Share on other sites

  • 4 months later...

We're not prioritizing it as we're not using javascript outside non-essential systems.

 

All our API endpoints are primarily for internal use, but left open for others to use, as long as we don't experience any issues with it, we're not going to prioritize it.

 

As for API-8, after some thoughts, it might never be fixed for the same reason as stated above.

Link to comment
Share on other sites

Ok @Tuxy Fluffyclaws , for those who wants use TruckersMP API via node.js , parsing api response with this package https://www.npmjs.com/package/json-bigint fix it , like below:

 

var resultText = await this.executeRequest('player/' + playerID);

var result = JSONbig.parse(resultText);

 

Edited by dowmeister

Trucky - The Virtual Trucker Companion app

Owner and Lead Developer

 

spacer.png

 

Mobile App, In-Game Overlay, Dispatcher, Automatic Recording on collision, In-Game Radio streaming, Discord Rich Presence Integration

 

Download Trucky on your mobile device - Install Trucky for Windows - Trucky Website

 

 

Link to comment
Share on other sites

Just to add to that^

 

If you use axios, you can instantiate it with an override on the transformResponse like so:

{ transformResponse: [data => JSONbig.parse(data)] }

 

Link to comment
Share on other sites

  • 4 weeks later...

Hi.

I have met similar problem but trying to import data to Google Sheet

Using JS script adding ImportJSON function, I get wrong Steamid64

Reference links: http://blog.fastfedora.com/projects/import-json

https://github.com/bradjasper/ImportJSON

 

I'm not sure if problem comes from importJSON script or from JSON construction. 
Can you help me with this problem?

 

Example for test TMPID 

 

1103a0.jpg

 

 

Link to comment
Share on other sites

@[TPL] Bialy if you want, you can use Trucky API via calling this endpoint https://api.truckyapp.com/v2/truckersmp/player?playerID=:playerID , it resolves the steamID64 bug from original api serving the value as string.

 

It's part of API behing the Trucky Companion App 

 

  • Upvote 1

Trucky - The Virtual Trucker Companion app

Owner and Lead Developer

 

spacer.png

 

Mobile App, In-Game Overlay, Dispatcher, Automatic Recording on collision, In-Game Radio streaming, Discord Rich Presence Integration

 

Download Trucky on your mobile device - Install Trucky for Windows - Trucky Website

 

 

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.