API call (OAuth2)

Get help with using AutoHotkey and its commands and hotkeys
User avatar
thenasos
Posts: 79
Joined: 10 Nov 2015, 10:00

API call (OAuth2)

01 Jun 2017, 09:13

Hi, can't convert curl line.

Code: Select all

curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer APItoken' 'https://server/api/v1.0/discovery'
Response body:

Code: Select all

{
  "running": true,
  "status": "running"
}
Tried converting by using https://autohotkey.com/board/topic/1484 ... -api-call/, but looks like I suck..

Code: Select all

WinHTTP := ComObjCreate("WinHTTP.WinHttpRequest.5.1")
WinHTTP.Open("GET", "https://server.sebank.se/api/v1.0/discovery", 0)
WinHTTP.SetCredentials("APItoken", "x", 0)
WinHTTP.SetRequestHeader("Content-Type", "application/json")
Body = {"running", "status"}
WinHTTP.Send(Body)
Result := WinHTTP.ResponseText
Status := WinHTTP.Status

msgbox % "status: " status "`n`nresult: " result
GuiClose:
ExitApp
Shrek is love...

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, Bing [Bot], Googleye, jarhead, keylo, leehere10, mikeyww, roonyroox, songdg and 54 guests