Using an api key in amazon api gateway

0 votes

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 key into my JSON request as I have been using "x-api-key": "theKey"?

Apr 20, 2018 in AWS by Flying geek
• 3,280 points
2,735 views

2 answers to this question.

0 votes

The    x-api-key  parameter is passed as an HTTP header parameter which is not added to the JSON body. How you pass HTTP headers depend on the HTTP client you use.

For example, if you use curl and assuming that you POST the JSON payload, a request would look something like (where you replace [api-id] with the actual id and [region] with the AWS region of your API):

$ curl -X POST -H "x-api-key: theKey" -H "Content-Type: application/json" -d '{"key":"val"}' https://[api--id].execute-api.[region].amazonaws.com
answered Apr 20, 2018 by Cloud gunner
• 4,670 points
0 votes
Try with this X-Api-Key
answered Apr 17, 2019 by sampath
The same way mentioned by @Cloud gunner?

Related Questions In AWS

0 votes
1 answer

Using an API Gateway in conjunction with microservices and JWTs?

This is how we went about it... What ...READ MORE

answered Oct 17, 2018 in AWS by Priyaj
• 58,020 points
1,656 views
+1 vote
2 answers
0 votes
1 answer

How do I create folder under an Amazon S3 bucket through PHP API?

Of Course, it is possible to create ...READ MORE

answered Apr 24, 2018 in AWS by anonymous
11,443 views
0 votes
1 answer

Problem with Swift API Gateway key authorizatiion Ask

Try to add all the headers that ...READ MORE

answered Jun 12, 2018 in AWS by Cloud gunner
• 4,670 points
808 views
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,735 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,058 views
+1 vote
3 answers
+1 vote
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP