Question

I'm trying to scrape some public data from imgur.com using the v3 imgur api but whenever I make a request using curl I'm getting a 401.

This is how I'm calling the API (using this example from the example python app) -

curl -F "Authorization=Client-ID <my_client_id_provided_by_registering_my_app>" https://api.imgur.com/3/gallery/hot/viral/0.json

I've also tried

curl -F "client_id=<my_client_id>" https://api.imgur.com/3/gallery/hot/viral/0.json

So my question is, what format is the imgur api expecting for the auth header and how can I leverage it using curl or some other common bash utility?

Was it helpful?

Solution

The switch -F (or --form) is for sending HTTP forms. What you should use instead is -H (--header):

curl --header "Authorization: Client-ID $YOUR_ID" https://api.imgur.com/3/gallery/hot/viral/0.json
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top