Home > Enterprise >  How can stage variable be added in Integration Path override api gateway
How can stage variable be added in Integration Path override api gateway

Time:12-23

I am trying to use s3 with api gateway. I have a stage variable that stored bucket name for each stage. But not able to use it in path override or path parameters enter image description here

instead of bucket/{key} want to use stageVariable.variable/{key}. I have tried using ${stageVariable.variable}/{key},'${stageVariable.variable}'/{key} Nothing is working.

CodePudding user response:

Assuming you have a sage variable named bucketname:

enter image description here

You can reference this variable in the integration request as follows:

enter image description here

Please note, we reference a stage variable as ${stageVariables.name}, where the name is my case was bucketname. You can also find some examples in the AWS documentation: https://docs.aws.amazon.com/apigateway/latest/developerguide/stage-variables.html

  • Related