Title
#kolide
AoS

AoS

08/12/2019, 8:47 AM
I've tried using
curl -k -X POST -d "{"username": "test", "Password": "test"}" -H "Content-Type: application/json" <https://url/api/v1/kolide/login>
and also
curl -X POST -k --user "admin" -H "Content-Type: application/json" <https://url/api/v1/kolide/login>
c

Chris Broome

08/12/2019, 1:43 PM
Are you on Mac, Linux, or Windows?
1:44 PM
If on Linux or Mac, use single quotes around the body (data) of the request:
curl -k -X POST -d '{"username": "test", "Password": "test"}' -H "Content-Type: application/json"
1:44 PM
If on windows, you have to manually escape all the inner double quote marks
AoS

AoS

08/13/2019, 8:37 AM
I see.. Tried your example on Linux and it worked (was using Windows), Thanks!
8:39 AM
Do you think you could also help me send a distributed query? I'm using the URLs as shown here https://github.com/kolide/fleet/blob/master/server/service/handler.go but I get a 'EOF' error as before.
8:39 AM
The urls are
/api/v1/kolide/queries/run
and
/api/v1/kolide/queries/run_by_names
c

Chris Broome

08/13/2019, 2:51 PM
once you successfully authenticate, you get a
token
in the response
2:51 PM
you have to send that bearer token with all the other requests in the
Authorization
header
2:52 PM
so something like
curl -X POST <http://url/api/v1/kolide/queries/run> -H 'Content-Type: application/json' -H 'Authorization: Bearer <the token you got from the login response>' -d '{"body": "of the request"}'