Authorization with curl

358 views
Skip to first unread message

Iwo Garwoliński

unread,
Jul 2, 2015, 4:39:31 PM7/2/15
to gets...@googlegroups.com
Hi,
I'm trying to get some data from Sentry via curl.
I tried to enter my username and password with -u option. I also tried -H "Authorizartion: Basic <base64_username_password>".

I'm getting {"detail": "Authentication credentials were not provided."} message. 

I feel it's simple stuff but can't get through it.

Best regards,
Iwo

David Cramer

unread,
Jul 2, 2015, 4:47:05 PM7/2/15
to gets...@googlegroups.com, Iwo Garwoliński
Hi there

The API requires a special key, which was added somewhere in 7.x.

See the documentation for details.

(The error message is mostly useless, we just haven’t fixed it yet)

--
You received this message because you are subscribed to the Google Groups "sentry" group.
To unsubscribe from this group and stop receiving emails from it, send an email to getsentry+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Iwo Garwoliński

unread,
Jul 2, 2015, 4:54:42 PM7/2/15
to gets...@googlegroups.com, locz...@gmail.com
I'd be really thankful if you could give me an example or link to documentation.

David Cramer

unread,
Jul 2, 2015, 4:56:32 PM7/2/15
to gets...@googlegroups.com, Iwo Garwoliński, locz...@gmail.com
If the API works in your install it will have embedded docs.

https://app.getsentry.com/docs/api/ is our public docs for hosted Sentry

There are examples in the overview for how to use Auth etc.


Iwo Garwoliński

unread,
Jul 2, 2015, 5:02:40 PM7/2/15
to gets...@googlegroups.com, locz...@gmail.com
This is all I found about authentication. I've already tried it. I can authenticate with curl -X POST -u PUBLIC_KEY:SECRET_KEY /api/0/auth/ and it generates some csrftoken but I don't know if I can use them to get to some other resources. 

David Cramer

unread,
Jul 2, 2015, 5:04:24 PM7/2/15
to gets...@googlegroups.com, Iwo Garwoliński, locz...@gmail.com
You won’t be able to use /auth/ at this time.

Keep in mind the API is a mix of what we’re using internally and what we’ve made actually work publicly. Some things like /auth/ will eventually be usable but we haven’t built them out fully yet.

Iwo Garwoliński

unread,
Jul 2, 2015, 5:06:24 PM7/2/15
to gets...@googlegroups.com, locz...@gmail.com
How can I get some events then? When execute this GET /api/0/events/{event_id}/ I get the error.

David Cramer

unread,
Jul 2, 2015, 5:08:03 PM7/2/15
to gets...@googlegroups.com, Iwo Garwoliński, locz...@gmail.com
If you’re using a version which uses public/secret key it may not be implemented fully.

Otherwise as long as you have the correct URL it should work.

As of 7.6.0 that endpoint definitely works.


Message has been deleted

Iwo Garwoliński

unread,
Jul 2, 2015, 5:18:58 PM7/2/15
to gets...@googlegroups.com, locz...@gmail.com
What my links should look like?

David Cramer

unread,
Jul 2, 2015, 5:19:58 PM7/2/15
to gets...@googlegroups.com, Iwo Garwoliński, locz...@gmail.com
The docs should generate the correct links, otherwise just try both, as it’s going to be quicker than waiting on a response.

That said, the links are always going to be prefixed with /api/0/


Iwo Garwoliński

unread,
Jul 2, 2015, 5:22:01 PM7/2/15
to gets...@googlegroups.com, locz...@gmail.com
Ones with /api/0/ prefix aren't working and the other ones works but I'm not receiving any data.

David Cramer

unread,
Jul 2, 2015, 5:22:43 PM7/2/15
to gets...@googlegroups.com, Iwo Garwoliński, locz...@gmail.com
Are you on 7.6.0?

Otherwise we can’t help.


Iwo Garwoliński

unread,
Jul 2, 2015, 5:23:26 PM7/2/15
to gets...@googlegroups.com, locz...@gmail.com
7.5.4 :(

David Cramer

unread,
Jul 2, 2015, 5:25:00 PM7/2/15
to gets...@googlegroups.com, Iwo Garwoliński, locz...@gmail.com
The endpoints documented definitely work on 7.5.

Client keys in the API have been deprecated for a while though. You should be using Organization API keys.


Iwo Garwoliński

unread,
Jul 2, 2015, 5:28:05 PM7/2/15
to gets...@googlegroups.com, locz...@gmail.com
Ok, thanks for your time. I'll ask tomorrow at work.
Reply all
Reply to author
Forward
0 new messages