【问题标题】:Can't fix `NotFoundException` error when calling SendApiAsset in AWS CLI在 AWS CLI 中调用 SendApiAsset 时无法修复“NotFoundException”错误
【发布时间】:2022-12-15 03:17:41
【问题描述】:

最近,我一直在尝试使用 AWS CLI 从 AWS 市场访问数据产品。我有该产品的有效订阅;但是,每当我尝试通过 API 调用访问产品的任何端点时,都会收到 NotFoundException 错误。

与任务 2 中的 AWS workshop training 类似,即使用 AWS CLI 进行 API 调用,我尝试使用以下代码调用 SimilarWeb 端点:

aws dataexchange send-api-asset \
--data-set-id **************************** \
--revision-id **************************** \
--asset-id ******************************* \
--method GET \
--path '' \
--query-string-parameters 'param1=value1,param2=value2' \
--output json | jq -r '.Body' | jq '.params.querystring'

但导致以下错误:

An error occurred (NotFoundException) when calling the SendApiAsset operation: No method found matching route / for http method GET

如何修复此错误或从 AWS CLI 或使用 boto3 正确地对 SimilarWeb 的端点进行 API 调用?请发表您的建议。谢谢。

【问题讨论】:

    标签: boto3 aws-cli sendasynchronousrequest data-exchange similarweb


    【解决方案1】:

    AWS Data Exchange 上的每个 API 都有不同的签名,这将告知支持哪些路径以及如何格式化任何其他参数。 NotFoundException 通常在提供商的 API 中不存在该路径时出现。在这种情况下,提供者 SimilarWeb 有一系列端点,它们通常在 their website 上进行了描述,但没有一个符合您提供的示例 CLI 调用中指定的根路径。根据您要调用的端点,pathquery-string-parameters 的值将需要更改。

    例如,对于 website description endpointpath 将类似于 /v1/website/bbc.com/general-data/descriptionquery-string-parameters 将类似于 domain=bbc.com。使用 CLI 的调用将如下所示:

    aws dataexchange send-api-asset 
    --data-set-id <dataset_id> 
    --revision-id <revision_id> 
    --asset-id <asset_id> 
    --region us-east-1 
    --method GET 
    --path '/v1/website/bbc.com/general-data/description' 
    --query-string-parameters 'domain=bbc.com'
    

    API 数据产品应包含一个 OpenAPI 规范,该规范有助于说明支持的路径以及与每个路径关联的参数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-11
      • 2020-08-27
      • 2015-07-24
      • 2016-08-02
      相关资源
      最近更新 更多