Accessing gladys REST

Hi again,

$ curl -s  http://rock5b.local/api/v1/device | jq .
{
  "status": 401,
  "code": "UNAUTHORIZED",
  "message": "No authorization header or api key found"
}

According:
https://apidoc.gladysassistant.com/#api-User-LoginUser

$ curl -s -X POST http://rock5b.local/api/v1/login -d '{"email": "user@example.com", "password": "mypassword"}' | jq .
{
  "status": 500,
  "code": "SERVER_ERROR",
  "error": {}
}

No more information regarding this ‘SERVER_ERROR’.

Hello. You need to add header -H 'Content-Type: application/json;charset=utf-8'

curl -s -X POST http://rock5b.local/api/v1/login -H 'Content-Type: application/json;charset=utf-8' -d '{"email": "user@example.com", "password": "mypassword"}' | jq .

Will add it in documentation

1 Like

Thanks @cicoub13 ,
Yes, that header was missing.
Cheers
/sigis

1 Like