Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I have created an API key and added it to my functions. I have then deployed the API and tested it but still get:

"message": "Forbidden"

How do I pass the API key with my JSON request as I have been using "x-api-key": "theKey"?

1 Answer

0 votes
by (44.4k points)

The x-api-key is being passed to the HTTP header as a parameter. The HTTP client decides the way it is passed. For instance, if you use curl and also you POST the JSON payload, a request would look like this:

$ curl -X POST -H "x-api-key: theKey" -H "Content-Type: application/json" -d '{"key":"val"}' https://[api-id].execute-api.[region].amazonaws.com

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...