Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions
You are not logged in.
Pages: 1
Hi all,
I installed most recent version of lhc and generated API keys for 2 users.
Accessing the old 'xml' named api using username/password in body in posts works fine for me.
Accessing REST API however fails for some reason and the sparse documentation did not help me out up to now
Trying in Swagger, i first press authenticate button and provide username and API Key.
Calling any method afterwards fails with undocumented code "TypeError.Failed to fetch"
Code 200 Login
Code 400 Error
curl request was:
curl -X POST "http://192.168.11.129/restapi/login" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "username=xxx&password=xxx&generate_token=true&device=unknown"
When I try the same in Postman i get at least some more info:
Post on http://192.168.11.129/index.php/restapi/login
Basic Auth with username/password results in
{
"error": true,
"msg": "Authentification failed"
}
Basic Auth with username/api key delivers the same result
Any hints are highly appreciated, cause I really have no idea what to try.
Thx
-Martin
Offline
For some very very very weired reason it works in POSTMAN right now.
For anyone strumbling accross this post, here is what i did.
Create a Post to http://<yourIP>/index.php/restapi/login
Set Authorization in Postman to basic and provide username and API key there
Fill Body with all parameters found in Swagger
That is:
password <-- as given by lhc user configuration
username <-- as given by lhc user configuration
generate token <-- true
device <-- unknown worked for me
device_token <-- supply anything there
Then i do get json reply
{
"error": false,
"session_token": "3abd4209219b399096019cdac228f483"
}
Weeeehaaaa!
Offline
Thank you for the updates
Last edited by PeopleInside (2018-02-22 13:04:21)
PeopleInside - Live helper chat - free limited forum support!
For commercial support or GitHub [see FAQ here]
If you want to support this open source project, just donate [see support page]
Something wrong with the forum? [contact a superhero]
Offline
Nevertheless I'm still stuck - I do get an authorization token during login, but for a get request - let's assume getusers
e.g. http://192.168.11.129/index.php/restapi/getusers
I am not forced to pass it via parameter and get doesn't have any body - so what am I lacking here?
Again it's
{
"error": true,
"result": "Authorization failed!"
}
Still using basic authentication with username and api key
Any guesses?
Offline
What i would expect to work is passing the AUTH token in header as Bearer Token instead of Basic Auth for successive calls.
I'm beginning to doubt maturity of this REST interface
Offline
Sorry, I cannot help with that.
I informed the chat owner about this topic.
PeopleInside - Live helper chat - free limited forum support!
For commercial support or GitHub [see FAQ here]
If you want to support this open source project, just donate [see support page]
Something wrong with the forum? [contact a superhero]
Offline
Pages: 1