使用cURL将HTML发送到mailerLite时缺少HTML模板错误

使用cURL将HTML发送到mailerLite时缺少HTML模板错误,curl,httr,Curl,Httr,mailerLite是一个管理联系人和发送电子邮件的SaaS。我正在尝试使用他们的API向我的帐户添加HTML内容 他们的API是基于HTTP的,并且是RESTful的。根据他们的文档,我可以创建一个活动并添加HTML内容。有一个PHP和cURL示例: 我使用R,因此我添加了一个type=regular活动,如下所示: response <- POST("https://api.mailerlite.com/api/v2/campaigns",

mailerLite是一个管理联系人和发送电子邮件的SaaS。我正在尝试使用他们的API向我的帐户添加HTML内容

他们的API是基于HTTP的,并且是RESTful的。根据他们的文档,我可以创建一个活动并添加HTML内容。有一个PHP和cURL示例:

我使用R,因此我添加了一个
type=regular
活动,如下所示:

response <- POST("https://api.mailerlite.com/api/v2/campaigns", 
                 add_headers("X-MailerLite-ApiKey" = apiKey),
                 body = list(
                   "type" = "regular",
                   "segments" = 1291259,
                   "subject" = "New",
                   "from" = "<email>",
                   "from_name" = "<name>"
                 ))
现在错误是:
{“error”:{“code”:422,“message”:“未提供HTML模板”}}}~/:

我认为我发送的HTML是一个模板。我错过了什么

curl -X PUT "https://api.mailerlite.com/api/v2/campaigns/1291259/content" \
-d '{
    "html": "<h1>Title</h1><p>Content</p><p><small><a href=\"{$unsubscribe}\">Unsubscribe</a></small></p>",
    "plain": "Your email client does not support HTML emails. Open newsletter here: {$url}. If you do not want to receive emails from us, click here: {$unsubscribe}"
}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: <api-key>”
curl -X PUT "https://api.mailerlite.com/api/v2/campaigns/1291259/content" \
-d '{
    "custom_html": "<h1>Title</h1><p>Content</p><p><small><a href=\"{$unsubscribe}\">Unsubscribe</a></small></p>",
    "plain": "Your email client does not support HTML emails. Open newsletter here: {$url}. If you do not want to receive emails from us, click here: {$unsubscribe}"
}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: <api-key>”