0

您好以下是我对 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' } }
4

2 回答 2

0

我想也许问题是你的'Content-Type'标题。根据文档添加订阅者,您必须以这种方式设置标题:

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-urlencodedOauth 作为 Auth 过程的一部分。

希望这可以帮助某人

于 2020-05-19T16:17:19.887 回答
0

In AWeber's API the missing email errors mean exactly what they sound like, the email was missing from your request once it got to AWeber.

It sounds like things might not be encoded or included properly in your request. If you print out the request body before you send it what does it look like, is everything there? Are you sending the data with a content-type of application/json?

In addition, is the OAuth signature being formed correctly? We highly recommend the use of a library to help you out there. These will help you encode your request with all the proper signatures to make sure the data makes it to us correctly.

AWeber provides PHP and Python examples of creating a subscriber, and while you might not be using those languages you can perhaps use them to figure out where you went wrong. Those are available here: https://api.aweber.com/#tag/Manage-a-Subscriber

于 2018-12-12T16:58:15.907 回答