What value do I insert inside the body of my API request according to this API Specification?

0

I'm trying to make a data request call from a data exchange API based on the data provider's API specification.

My app is built using the Node.JS and NPM.

I'm subscribed to use the API and I've verified that all my identity credentials, policies and IAM keys that give me permission to access the API.

However when I test the request call in AWS CLI, I get the message '404: Asset not found'.

What could be the problem with my API request call?

Thanks!

My current request code looks like below:


aws dataexchange send-api-asset \
  --data-set-id xe4xxxxxxxxxx72b7edxxxx6 \
  --revision-id xx54cxxxxxxxx9d05d81xxxxxxxx \
  --asset-id xxxxxxbde1fa3d5xxxxe2bb5xx \
  --method POST \
  --path "/psdm/graphql/" \
  --query-string-parameters 'param1=value1,param2=value2' \
  --request-headers '{"Content-Type": "application/json"}' \
  --body '{"content": {
            "application/graphql": {
              "schema": {
                "$ref": "#/components/schemas/CatalogSearchRequest"
              },
              "value": "{ursa_udp_availablemetadatarecord(limit: 10 content: {catalogProperties: { vendor: { eq: \"ICEYE\" } } } ) { assignedId }}"
            }
          },
          "required": true
        }'

The Actual API Specification:

{
  "openapi": "3.0.1",
  "info": {
    "title": "image-services",
    "description": "API Gateway for integration of Platform Services into AWS Data Exchange",
    "version": "2022-03-03T20:04:18Z"
  },
  "servers": [
    {
      "url": ""
    }
  ],
  "paths": {
    "/psdm/graphql": {
      "post": {
        "requestBody": {
          "description": "GraphQL query for the Catalog in the form of:\n\n  `{\n    availablemetadatarecord(\n      QUERYPARAMS\n    ) { \n      FIELDLIST\n    } \n  }`\n",
          "content": {
            "application/graphql": {
              "schema": {
                "$ref": "#/components/schemas/CatalogSearchRequest"
              },
              "examples": {
                "Limit returned data": {
                  "description": "Limit the number of records in a response.\n\nIn your query, simply specify `limit: <int>` \n",
                  "value": "{\n  availablemetadatarecord(\n    limit: 10\n    content: { catalogProperties: { vendor: { eq: \"EYE\" } } }\n  ) {\n    assignedId\n  }\n}\n"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "200 response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogSearchResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "sigv4": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "CatalogSearchRequest": {
        "title": "CatalogSearchRequest",
        "type": "object"
      },
      "CatalogSearchResponse": {
        "title": "Catalog Search Response",
        "required": [
          "data",
          "paginationInfo"
        ],
        "type": "object",
        "properties": {
          "paginationInfo": {
            "type": "object",
            "properties": {
              "recordsInPage": {
                "type": "integer"
              },
              "nextOffset": {
                "type": "integer"
              }
            }
          },
          "data": {
            "type": "object",
            "properties": {
              "availablemetadatarecord": {
                "type": "array",
                "description": "Records returned by query",
                "items": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "sigv4": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header",
        "x-amazon-apigateway-authtype": "awsSigv4"
      }
    }
  }
}
已提问 1 年前338 查看次数
1 回答
1

Hello,

It looks like your request body includes extra information from the OpenAPI spec that doesn't belong in the request body itself. Additionally, the content type should be application/graphql, there should be no query parameters, and I believe the path forward-slashes need to be escaped if you are running this through a CLI. Could you try:

aws dataexchange send-api-asset \
  --data-set-id xe4xxxxxxxxxx72b7edxxxx6 \
  --revision-id xx54cxxxxxxxx9d05d81xxxxxxxx \
  --asset-id xxxxxxbde1fa3d5xxxxe2bb5xx \
  --method POST \
  --path "\/psdm\/graphql\/" \
  --request-headers '{"Content-Type": "application/graphql"}' \
  --body "{ursa_udp_availablemetadatarecord(limit: 10 content: {catalogProperties: { vendor: { eq: \"ICEYE\" } } } ) { assignedId }}"
已回答 1 年前
  • The API specification looks like above (I've updated the question). I'm having trouble understanding what values I should insert into the 'body' parameter.

  • Issue persists. However a command like 'aws dataexchange getDataSet(params)' works. So I really do not know what the issue is with 'send-api-asset'. Tried to find demos online for this particular API but couldn't.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则