dowmeister Posted April 24, 2017 Share Posted April 24, 2017 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? Thank you! Trucky - The Virtual Trucker Companion app Owner and Lead Developer 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 More sharing options...
Guest Posted April 24, 2017 Share Posted April 24, 2017 The correct one shows for me. Link to comment Share on other sites More sharing options...
dowmeister Posted April 25, 2017 Author Share Posted April 25, 2017 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) 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 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 More sharing options...
Guest Posted April 25, 2017 Share Posted April 25, 2017 ^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 More sharing options...
dowmeister Posted April 25, 2017 Author Share Posted April 25, 2017 Thank you @Tuxy Fluffyclaws Trucky - The Virtual Trucker Companion app Owner and Lead Developer 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 More sharing options...
dowmeister Posted May 19, 2017 Author Share Posted May 19, 2017 (edited) 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 May 20, 2017 by dowmeister Trucky - The Virtual Trucker Companion app Owner and Lead Developer 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 More sharing options...
Guest Posted October 3, 2017 Share Posted October 3, 2017 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 More sharing options...
dowmeister Posted October 3, 2017 Author Share Posted October 3, 2017 (edited) 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 October 3, 2017 by dowmeister Trucky - The Virtual Trucker Companion app Owner and Lead Developer 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 More sharing options...
Guest Posted October 6, 2017 Share Posted October 6, 2017 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 More sharing options...
[TPL] Bialy Posted November 3, 2017 Share Posted November 3, 2017 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 Link to comment Share on other sites More sharing options...
[TPL] Bialy Posted November 3, 2017 Share Posted November 3, 2017 No, no.. Don't be afraid. I wanna build spreadsheet for our Virtual Company. For now only 47 users. First records was only as an example Link to comment Share on other sites More sharing options...
dowmeister Posted November 3, 2017 Author Share Posted November 3, 2017 @[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 1 Trucky - The Virtual Trucker Companion app Owner and Lead Developer 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 More sharing options...
[TPL] Bialy Posted November 3, 2017 Share Posted November 3, 2017 @dowmeisterThank you Link to comment Share on other sites More sharing options...
Recommended Posts