help with Xboxapi Topic is solved

Ask gaming related questions (AHK v1.1 and older)
lukoslambro
Posts: 2
Joined: 23 Aug 2017, 02:58

help with Xboxapi

23 Aug 2017, 03:14

hello, i need help accessing the xboxapi but i cant find any documentation about this even tho i have seen similar a api accessed, but the curl code used with the script did not match the curl code xboxapi uses, and therefore didnt work. im specifically trying to access the presence portion of the api which displays online status and currently loaded apps/games.

the curl code xboxapi uses is thus:

Code: Select all

$ curl -s -H "X-AUTH: <api key>" https://xboxapi.com/v2/<accountxuid>
im trying to access the portion of the api located at the following website
https://xboxapi.com/v2/<accountxuid>/presence

when access is granted it outputs something like this:

Code: Select all

{"xuid":<accountxuid>,"state":"Online","devices":[{"type":"XboxOne","titles":[{"id":714681658,"name":"Home","placement":"Background","state":"Active","lastModified":"2017-08-23T07:03:06.44878Z"}]}]}
when access is denied it outputs this:

Code: Select all

{"success":false,"error_code":401,"error_message":"No API Key provided or invalid API Key"}
i simply need the output to be put into a string variable

thanks for your assistance
lukoslambro
Posts: 2
Joined: 23 Aug 2017, 02:58

Re: help with Xboxapi  Topic is solved

23 Aug 2017, 23:15

ok, i figured it out

had to search for windows object handling for http requests and the curl command's options to figure it out

the fully working code is thus:

Code: Select all

WinHTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WinHTTP.Open("GET", "https://xboxapi.com/v2/<accountxuid>/presence", true)
WinHTTP.SetRequestHeader("X-AUTH", "<api key>")
WinHTTP.Send()
WinHTTP.WaitForResponse()
<output variable> := WinHTTP.ResponseText
thanks for your time anyway, and i hope this proves useful to someone else

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 46 guests