• 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 API Login

Status
Not open for further replies.

ArrMeeR

Member
Hello,
When I use try to use api (https://www.sinusbot.com/api/) to login with this command:
Code:
curl --data 'username=admin&password=password' http://server:8087/api/v1/bot/login

It shows error:
Code:
{"code":406,"error":"'username' or 'password' not set","success":false}

Is this bug or am i doing something wrong?
 

flyth

is reticulating splines
Staff member
Developer
Contributor
Send the credentials in the body of that request - with curl, use something like
Code:
curl -X POST -d '{"username": "xx", "password": "foobar"}' -H "Content-Type: application/json" 
http://server:8087/api/v1/bot/login
 

ArrMeeR

Member
Still the same

Code:
curl -X POST -d '{"username": "xx", "password": "foobar"}' -H "Content-Type: application/json" http://server:8087/api/v1/bot/login

{"code":406,"error":"'username' or 'password' not set","success":false}
 

flyth

is reticulating splines
Staff member
Developer
Contributor
You need to add the botId as well, sorry... That error message is a bit weird, will change it.

Code:
curl -X POST -d '{"username": "xx", "password": "foobar", "botId": "fillme"}' -H "Content-Type: application/json" http://server:8087/api/v1/bot/login
 

Zahzi

Member
You need to add the botId as well, sorry... That error message is a bit weird, will change it.

Code:
curl -X POST -d '{"username": "xx", "password": "foobar", "botId": "fillme"}' -H "Content-Type: application/json" http://server:8087/api/v1/bot/login

I'm not getting any response from the server using this.

I have tried on a fresh install using the install script on Ubuntu 16. I am also getting no response from /api/v1/bot/login. The page is blank in browser as CURL doesn't return any response.
 

Xuxe

Containerholic
Staff member
is awesome!
V.I.P.
Contributor
Insider
I get no response from the server using this. I have tried on a fresh install using the install script on Ubuntu 16. I am also getting no response from /api/v1/bot/login. The page is blank in browser as well as no response from CURL.

Check the response status code, there must be a response or error status code.
 

Zahzi

Member
Running curl with verbose mode shows 401 Unauthorized for info.

Login shows forbidden.
1507424516.png
 
Status
Not open for further replies.
Top