Access any profile page by providing the username and API key (generated in the settings -> API) , e.g.
https://trackobot.com/profile/history.json?username=cool-ancient-tree-1337&token=fhyf238cv2eh879
Any profile page can be requested as JSON. Simply add .json
at the end of the url (but before the query string which starts with ?
), see example above.
Use the browser to see the JSON structure. JSONView is an excellent browser extension which shows JSON in a nice way.
You can upload results with POSTing to /profile/results.json
(don't forget to add the username and API key at the end).
The body of the POST should look like this:
{
"result": {
"hero": "Shaman",
"opponent": "Warrior",
"mode": "ranked",
"coin": true,
"win": true
}
}
You can include additional (optional) information, e.g.:
{
"result": {
"hero": "Shaman",
"opponent": "Warrior",
"mode": "ranked",
"coin": true,
"win": true,
"duration": 634,
"card_history": [
{
"card_id": "EX1_405",
"player": "opponent"
},
{
"card_id": "GAME_005",
"player": "me",
"turn": 3
}
]
}
}
@fverdoja I just had success POSTing the following result to
https://trackobot.com/profile/results.json
after:Content-Type
header toapplication/json
Authorization
header toBasic USERNAME:TOKEN
username:token
portion as per the specI got back a
201 Created
.You'll note that I have the authorization included in both the headers and the JSON body. Looking through the source code, it appears that the headers are what the Track-o-Bot app uses, but i threw it into the body as well just because the doc above is pretty vague. Feel free to let us know if it works without them in the JSON body.