I'm trying to figure out a way to pass path variables in aws step functions for api gateway invocation. I was able to pass query parameters as shown here:- https://docs.aws.amazon.com/step-functions/latest/dg/connect-api-gateway.html
How do i pass path variables?
Edit 1: Adding more info : how do i pass path variable which i receive in the response from previous step ?
Just specify the full path string in Path
. For example (other attributes are hidden for clarity):
{
"Type": "Task",
"Resource":"arn:aws:states:::apigateway:invoke",
"Parameters": {
"ApiEndpoint": "example.execute-api.us-east-1.amazonaws.com",
"Path": "pet/5",
...
}
This will invoke:
example.execute-api.us-east-1.amazonaws.com/pet/5
So that if you have configured your resource path as
/pet/{pet_id}
The value of path parameter pet_id
will be 5
.
EDIT
Since OP explained the need to loop and call the API with different ID values, suggest to create a custom Lambda, and custom code the logic to loop through each ID and call the API. Or, you can code the loop to occur in the workflow itself. See https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-create-iterate-pattern-section.html.