• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

Solved How to use the Sinusbot API

Hello,

I have a problem accessing your API. I try to login using JavaScript. Am I doing something essentially wrong?

JavaScript:
    var xhttp = new XMLHttpRequest();
        xhttp.open("POST", "https://example.com:8087/api/v1/bot/login", false);
        xhttp.send(JSON.stringify({"username":"admin","password":"myCorrectPassword","botId":"c5ffcfd7-d27e-b886-45d0-64b16a005246"}))

I get only a 406 as return code with no further information.

Code:
Request URL: https://example.com:8087/api/v1/bot/login
Request Method: POST
Status Code: 406
Remote Address: ip:8087
Referrer Policy: no-referrer-when-downgrade
content-length: 0
content-type: text/plain; charset=utf-8
date: Mon, 23 Apr 2018 05:16:39 GMT
status: 406
:authority: example.com:8087
:method: POST
:path: /api/v1/bot/login
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
content-length: 89
content-type: text/plain;charset=UTF-8
origin: https://example.com:8087
referer: https://example.com:8087/play/list/25c5fa13-e83f-4396-9ddc-9694382e8990
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36
{"username":"admin","password":"MyCorrectPassword","botId":"c5ffcfd7-d27e-b886-45d0-64b16a005246"}
 
Top