【问题标题】:Aweber: 'Missing required argument: [email]'Aweber:“缺少必需的参数:[电子邮件]”
【发布时间】:2018-12-10 07:27:28
【问题描述】:

你好以下是我对 Aweber 创建订阅者的请求输入

{ body: '{"tags":[1,2],"email":"<email_id>","ws.op":"create"}',
  method: 'POST',
  uri: 'https://api.aweber.com/1.0/accounts/<accountID>/lists/<list id>/subscribers',
  headers: 
   { Authorization: 'OAuth oauth_consumer_key="<consumer key>",oauth_nonce="<oauth_nonce>",oauth_signature_method="<signature>",oauth_timestamp="<timstamp>",oauth_version="1.0",oauth_token="<token>",oauth_signature="<oauth signature>',
     'Content-Type': 'application/x-www-form-urlencoded' } }

我在正文中传递电子邮件,但仍然收到错误

{ error: 
 { status: 400,
 documentation_url: 'https://labs.aweber.com/docs/troubleshooting#badrequest',
 message: 'Missing required argument: [email]',
 type: 'MissingArgumentError' } }

【问题讨论】:

    标签: aweber


    【解决方案1】:

    在 AWeber 的 API 中,丢失的电子邮件错误的含义与听起来完全一样,一旦到达 AWeber,您的请求中就丢失了电子邮件。

    听起来您的请求中可能未正确编码或包含某些内容。如果您在发送之前打印出请求正文,它是什么样子的,一切都在那里吗?您是否发送内容类型为 application/json 的数据?

    此外,OAuth 签名是否正确形成?我们强烈建议使用图书馆来帮助您。这些将帮助您使用所有正确的签名对您的请求进行编码,以确保数据正确地发送给我们。

    AWeber 提供了创建订阅者的 PHP 和 Python 示例,虽然您可能没有使用这些语言,但您也许可以使用它们来找出问题所在。这些可以在这里找到: https://api.aweber.com/#tag/Manage-a-Subscriber

    【讨论】:

      【解决方案2】:

      我认为问题可能出在您的 'Content-Type' 标头上。根据文档Add subscriber,您必须以这种方式设置标题:

      headers = {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'Authorization': "Bearer #{access_token}"
      }
      

      使用application/json 代替application/x-www-form-urlencoded,但也使用'Accept': 'application/json'。我只是使用 x-www-form-urlencoded 作为 Oauth 身份验证过程的一部分。

      希望这对某人有所帮助

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-11-17
        • 2021-11-05
        • 2018-10-28
        • 2018-12-01
        • 2016-06-29
        • 2018-06-20
        相关资源
        最近更新 更多