AWS Step Function 中的路径变量

Path variables in AWS Step Function

我正在尝试找出一种在 aws 步骤函数中为 api 网关调用传递路径变量的方法。 我能够传递查询参数,如下所示:- https://docs.aws.amazon.com/step-functions/latest/dg/connect-api-gateway.html

如何传递路径变量?

编辑 1:添加更多信息:如何传递我在上一步的响应中收到的路径变量?

只需在 Path 中指定完整路径字符串即可。例如(为清楚起见隐藏了其他属性):

{
    "Type": "Task", 
    "Resource":"arn:aws:states:::apigateway:invoke", 
    "Parameters": {
        "ApiEndpoint": "example.execute-api.us-east-1.amazonaws.com",
        "Path": "pet/5",
        ...
}

这将调用:

example.execute-api.us-east-1.amazonaws.com/pet/5

因此,如果您将资源路径配置为

/pet/{pet_id}

路径参数 pet_id 的值将是 5

编辑

由于 OP 解释了需要使用不同的 ID 值循环和调用 API,建议创建一个自定义 Lambda,并自定义代码循环遍历每个 ID 并调用 API .或者,您可以将循环编码为在工作流本身中发生。参见 https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-create-iterate-pattern-section.html