【问题标题】:How to pass input parameters into a POST method in api gateway?如何将输入参数传递给 api 网关中的 POST 方法?
【发布时间】:2017-05-19 10:57:01
【问题描述】:

所以我使用 API 网关(亚马逊网络服务)。我做了一个名为“addUser”的简单发布方法,它接受几个字符串参数(用户名、名字、电子邮件等)并在我的用户表(dynamoDB)中生成一个用户。问题是,当我部署 API 时,我收到以下错误:

{"message":"Missing Authentication Token"} 

Get 方法可以很好地接受输入,但我的 Post 方法不能。我不知道如何解决这个问题。

这是我的用户 API 的屏幕截图

这里是调用 url:

https://xxxxxxxxxx.execute-api.us-west-2.amazonaws.com/userAPI/adduser

这是我在方法请求中使用的输入模型:

{
    "$schema":"http://json-schema.org/draft-04/schema#",
    "type":"object",
    "properties":{
        "email":{"type":"string"},
        "birthdate":{"type":"string"},
        "firstName":{"type":"string"},
        "lastName":{"type":"string"},
        "userName":{"type":"string"},
        "phoneNumber":{"type":"string"},
        "profileImageURL":{"type":"string"}
    },
    "title":"InputaddUser"
}

这是我在邮递员中使用的输入正文:

{
  "email": "qteenfadfaf1@gmail.com",
  "birthdate": "1/1/1990",
  "firstName": "Qafasdmafdfadfafr",
  "lastName": "Ffafafadasdfafrooqfsaui",
  "username": "Caster7",
  "phoneNumber": "some #",
  "profileImageRef ":"something"
}

【问题讨论】:

    标签: amazon-web-services aws-lambda aws-sdk postman aws-api-gateway


    【解决方案1】:

    “缺少身份验证令牌”消息意味着您实际上并未发送 POST 请求。尝试Postman 轻松测试您的 API。我使用您提供的 API URL(我在帖子中删除)进行了测试,它使用 POST 方法对我有用。

    用 cURL 试试curl -X POST ...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-05
      • 2016-05-29
      • 2017-05-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多