{"message":"Forbidden"}

{"message":"Forbidden"}

Posted 7 Aug 2019, 15:43:28

Hi. It doesn't seem to matter what endpoint I try and access I get “Forbidden” as a response. I have tried curl, swagger and a browser. Any ideas what I might be doing wrong?

Re: {"message":"Forbidden"}

Posted 7 Aug 2019, 15:45:19

Do you include the `x-api-key` header set with your API key?

Best to start with the interactive interface (paste your api key into the field in the top-right corner). You'll also get the curl commands there.

Re: {"message":"Forbidden"}

Posted 7 Aug 2019, 15:53:58

Yes, i said in my post that I had tried swagger.

In swagger, do I need to put 'x-api-key'?

swagger doesn't actually give me a “Forbidden” but just never returns a result.

Re: {"message":"Forbidden"}

Posted 7 Aug 2019, 15:55:18

Here's my curl command:

curl -X GET —header 'Accept: application/json' —header 'x-api-key:[key]'--url 'https://api.setlist.fm/rest/1.0/artist/0bfba3d3-6a04-4779-bb0a-df07df5b0558'

Re: {"message":"Forbidden"}

Posted 7 Aug 2019, 15:58:53

Weird, I just tried the interactive interface with your API key and it worked, curl works too:

curl -X GET —header 'Accept: application/json' —header 'x-api-key: yourapikey' 'https://api.setlist.fm/rest/1.0/search/setlists?artistName=beatles&p=1'

Re: {"message":"Forbidden"}

Posted 7 Aug 2019, 16:04:11

(note that the copy+paste gets messed up in this forum)

Re: {"message":"Forbidden"}

Posted 7 Aug 2019, 16:09:35

Thanks. In what way is your copy and paste messed up?

When I tried curl I had to add the —url switch (not in your version of the command).

Re: {"message":"Forbidden"}

Posted 8 Aug 2019, 6:17:08

In what way is your copy and paste messed up?

I noticed that e.g. the double dash for the “header” switch gets changed to a single long dash in the forum. The `url` switch isn't required when added as last parameter. Did it work for you now? As said I tested it with your API key and couldn't see any issues.

Re: {"message":"Forbidden"}

Posted 8 Aug 2019, 10:58:11

OK, thanks. Yes, I'd fixed up the double dash thing.

In the mac terminal, the command seemed to require I include the 'url' switch. However, I just tried it by deleting that and it worked!

I knew I must have been doing something wrong but I'm not sure what it was …

Thanks.

Re: {"message":"Forbidden"}

Posted 8 Aug 2019, 11:48:00

You're welcome, glad that it works now!

Post Reply

You're not allowed to do this, please sign in first.