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,150 points
145 views

2 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,250 points
0 votes
Try with this X-Api-Key
answered Apr 17 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
• 56,140 points
55 views
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
1,791 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,250 points
35 views
0 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
• 56,140 points
81 views
+13 votes
2 answers
+1 vote
3 answers

Log in to AWS using Access Key ID and Secret Access Key ID

Access keys consist of an access key ...READ MORE

answered Aug 17, 2018 in AWS by Priyaj
• 56,140 points
131 views
+1 vote
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.