Rob Dawson
Rob Dawson

Reputation: 1347

How do I get the request url in API Gateway?

I'd like to get the request URL from API Gateway and pass it through to a lambda function.

I've looked at http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html and tried out the 'Method Request passthrough' body template, but I couldn't see a simple way of doing it.

My use case is I want to return the full url of a resource that was just created with a post method.

I'd like to include the URL used by API gateway to create the object, as it is the initial place, but it might be something that changes moving forward, and it would be simplest (I think) to have a fully qualified url being returned and used, where this would be based off of the url that the request was made on.

Upvotes: 3

Views: 1992

Answers (1)

Ka Hou Ieong
Ka Hou Ieong

Reputation: 6515

There is no simple way that can pass a fully qualified request URL to your integration, but since you always have control on your request body, you are construct the request url in a mapping template.

Thanks,

Ka Hou

Upvotes: -3

Related Questions