【发布时间】:2017-04-24 13:17:03
【问题描述】:
我正在尝试使用 Mailchimps API (v3) 和 REST Client gem create 一个 Mailchimp 列表。我已经正常工作以检索列表名称和 ID。但是,我收到了401 Unauthorized - API Key Missing 响应以创建列表。我认为我的帖子请求格式不正确,但我无法确定我哪里出错了。我的代码如下所示:
params_hash = {
name: "#{territory}",
contact: {
company: "Company",
address1: "Address",
city: "City",
state: "State",
zip: "0000",
country: "US"
},
permission_reminder: "You are receiving this email because....",
campaign_defaults: {
from_name: "From Name",
from_email: "contact@contact.com",
subject: "Subject",
language: "en"
},
notify_on_subscribe: "contact1@contact.com",
notify_on_unsubscribe: "contact1@contact.com",
email_type_option: true,
apikey: mailchimp_key
}
RestClient.post("#{mailchimp_url}/lists", { params: params_hash }) { |response, request, result, &block|
}
【问题讨论】:
标签: ruby-on-rails ruby rest mailchimp mailchimp-api-v3.0