针对如何通过MailchimpMarketingAPI用可重复的内容填充营销模板这个问题,本篇文章进行了详细的解答,同时本文还将给你拓展APIPUT/marketing/contacts/import
针对如何通过 Mailchimp Marketing API 用可重复的内容填充营销模板这个问题,本篇文章进行了详细的解答,同时本文还将给你拓展API PUT /marketing/contacts/imports with restsharp、criteo marketing api 相关、Facebook Marketing API - 如何处理通过广告系列 ID 检索*所有*广告集的速率限制?、Facebook Marketing API 广告集创建返回空数组等相关知识,希望可以帮助到你。
本文目录一览:- 如何通过 Mailchimp Marketing API 用可重复的内容填充营销模板
- API PUT /marketing/contacts/imports with restsharp
- criteo marketing api 相关
- Facebook Marketing API - 如何处理通过广告系列 ID 检索*所有*广告集的速率限制?
- Facebook Marketing API 广告集创建返回空数组
如何通过 Mailchimp Marketing API 用可重复的内容填充营销模板
如何解决如何通过 Mailchimp Marketing API 用可重复的内容填充营销模板
我有使用模板的campaing,我需要通过Marketing API 发送带有5 个(或更多)最新工作机会的活动。我正在努力寻找方法。
我尝试在简单示例中使用模板语言。
我已将此块添加到模板:<h3 mc:edit="article_title">Title</h3>
然后我尝试使用 PHP 库 mailchimp/marketing:3.0.27
更新广告系列内容:
$campaign = $this->mailchimp->campaigns->setContent($campaignId,[
''template'' => [
''id'' => (int) $templateId,''sections'' => [
''article_title'' => ''Test title'',],]);
此请求已成功运行,但我在响应、广告设计或测试电子邮件方面没有看到任何变化。
我做错了什么?或者也许有其他方法可以解决我的问题?
我也尝试向 Mailchimp 支持人员询问这个问题,但没有得到答复。
解决方法
事实是这个功能没有实现,也不会工作。
API PUT /marketing/contacts/imports with restsharp
如何解决API PUT /marketing/contacts/imports with restsharp?
由于内部原因,我需要将我的 servlet 从 Java 重新编码为 c#。 我正在尝试使用带有 restsharp 的 API PUT /marketing/contacts/imports 上传 CSV 文件。 我无法正确发送文件。
代码片段 请在我的 Java 代码段下方正常工作:
File file = new File(CSV);
byte[] data;
try {
data = Files.readAllBytes(file.toPath());
HttpResponse<String> response2 = Unirest.put(URLSengrid)
.header(processSendgridHeader(headerFromSengrid).get(0),processSendgridHeader(headerFromSengrid).get(1))
//("x-amz-server-side-encryption","aws:kms")
.body(data)
.asstring();
} catch (IOException e) {
// Todo Auto-generated catch block
e.printstacktrace();
}
这里是非工作的 c# 代码:
byte[] file = System.IO.File.ReadAllBytes(testPath);
var clientSecondCall = new RestClient(URLSendgrid);
var requestSecondCall = new RestRequest(Method.PUT);
requestSecondCall.AddHeader("content -type","application/json");
requestSecondCall.AddHeader("x-amz-server-side-encryption","aws:kms");
requestSecondCall.AddParameter("application/json","{"file_type":"csv","field_mappings":["e1_T","e2_T","_rf2_T","e4_T","e5_T","e12_T","e13_T","e14_T","e15_T","e16_T"]}",ParameterType.RequestBody);
requestSecondCall.AddFile("file",file,testPath);
我花了很长时间寻找答案,但没有成功。任何帮助将不胜感激
技术细节: sendgrid-csharp 版本:9.* csharp 版本:v4.0.303190
解决方法
我认为问题在于您在 c# 代码中发送文件的方式。
Java 代码显然使用了请求的 Body,而 c# 代码使用的是 RestSharp。
Restsharp 以多部分形式发送文件,您的服务器可能没有资格处理。
我建议使用 HttpClient 对象:
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage();
request.Method = HttpMethod.Put;
request.RequestUri = new Uri( "Your Url");
request.Content = new StringContent(File.ReadAllText(yourFilePath));
request.Headers.Add("your header name","your header value");
var response = client.SendAsync(request).Result;
criteo marketing api 相关
官网登陆地址:https://marketing.criteo.com/
官网api介绍:https://marketing.criteo.com/e/s/article?article=360001226005-Marketing-API-details&language=en_US
官网swagger:https://api.criteo.com/marketing/swagger/ui/index
python包github地址:https://github.com/criteo/criteo-python-marketing-sdk
Testing Criteo Marketing API:https://marketing.criteo.com/e/s/article?article=360001226125-Testing-Criteo-Marketing-API&language=en_US
currency:The currency code used must match the ISO 4217 Currency Code Standard.
Criteo Resellers Program API:https://marketing.criteo.com/e/s/article?article=360001265360-Criteo-Resellers-Program-API-Guide-V2-0&language=en_US
the Business Manager role
Time Zone
All dates in the Criteo REST API are shown in Coordinated Universal Time (UTC).
Data Freshness
Remaining budget and statistics are not real time and can have up to a few hours of delay. Hence a seller can be inactive while their remaining amount is still decreasing. The sellers’ ads are not displayed anymore, but the remaining budget is decreasing as data is catching up.
API usage recommendations
When updating large batches of budgets or bids, you should implement these changes in separated, batched API calls as opposed to many individual calls as this may lead to throttling.
One call should be marked for bids, and another call for budgets. Both calls will contain the correct bids per campaigns and budgets for the given or multiple campaigns.
EXAMPLE: You need to set bids and budgets for 10 different sellers. We recommend you send 1 API call for seller-campaign endpoint and 1 call for budgets endpoint, with both containing respective sellers desired bids and budgets.
How do I authenticate the API?
Criteo uses JWT to provide token based authentication system to our REST API. In order to issue calls to our API, you will need to pass a token on to any of these calls.
To get your token, you will need to issue a POST call to the /oauth2/token endpoint, with client_id and client_secret as parameters (see Getting Started section).
NOTE: Each token is valid for 5 minutes. Should your token expire, you will receive a 401 HTTP response status code.
认识JWT
product & campaign
Advertising objectives:
-
Web traffic: Increase visits to your website, where people can find more information about your products and services and consider buying. For example, to generate interest in a new line of products, you could reach people who have shown interest in your products in the past and bring them to your website to learn about the new line.
-
App Installs (coming soon): Drive people to download your app. This can include brand new customers, or existing customers who have purchased from you online or in your store, but who haven’t downloaded your app yet.
- The Conversion objective is used by marketers looking to drive the highest number of conversions at the lowest cost. This objective will inform the bidding strategy, placing a higher value on people who are most likely to convert. For example, a hotel website may use this objective to increase bookings from people searching for last-minute hotels. These users are more likely to convert – and therefore valued higher – than those looking for dates further out. As a result they see increased conversions from this campaign.
- The Revenueobjective will help maximize revenue at the lowest cost. For example, a furniture company may use this objective to sell higher ticket items such as bedroom sets in order to increase revenue, because people who show interest in these more expensive products will be valued higher than those looking at lower-ticket items. As a result, their campaign will deliver conversions with a higher average order value.
- The New customer objective will target people who are interested in your products or services, but who have never purchased before. For example, a bike company will value people who have never purchased from their site higher than loyal customers.
seller & budget & bid & campaign
What if one of my sellers changed the name on my platform?
As our API essentially relies on sellerName to manage bids and budgets, any change in seller name will automatically create a new entry in our system, not linked to the previous seller name.
In a nutshell, if a seller changes its name on your platform, you will need to:
- Update your product feed with the new sellerName
- Initialize your seller''s bid and budget by sending us a PUT /v2/crp/seller-campaigns & POST /v2/crp/budgets
the Criteo Reseller Program REST API which allow you to manage campaigns bids and budgets at the sellers level
Criteo REST API for Resellers
ONBOARDING A SELLER IN THE CRITEO RESELLER PROGRAM
To onboard a new seller, you will need to make sure he is properly flagged in the Product Feed catalog you''ve previously shared with Criteo.
To make sure your seller is properly flagged, you will need to set the seller name column to the seller unique identifier, which is the seller name for each of your seller’s products provided in the feed.
Tip: A seller becomes active once you send us available products through the feed & both their bid and budget.
After the steps above, you will be able to send us your sellers’ budget and bids thanks to the sellers'' endpoints described previously, especially:
- PUT /v1/sellers/bids to send us the sellers’ CPC
- POST /v1/sellers/budgets to send us the seller’s budget
Tip: You can retrieve the full list of sellers with their status (active/inactive) by issuing a GET call to the seller’s endpoint, providing your Criteo Reseller Program campaign identifier (CampaignID) as a parameter.
Tip:
A seller is:
- Active if: it has a budget and a bid and at least one product in the catalog
- Inactive if:
- in its initial status, you’ve declared the sellerName in the Product Feed and not declared yet any budget and/or bid,
- it has no active budget (see later budgetStatus).
ads page & ads Placement
After a page is registered, your Criteo Technical Solutions Engineer will setup Ad placements where the sponsored Ads will be shown on your site
tag 平台
Facebook Marketing API - 如何处理通过广告系列 ID 检索*所有*广告集的速率限制?
如何解决Facebook Marketing API - 如何处理通过广告系列 ID 检索*所有*广告集的速率限制??
我最近开始使用 Facebook Marketing API,使用适用于 Python 的 facebook_business
SDK(在 Ubuntu 20.04 上运行 v3.9)。我想我大部分时间都在思考它是如何工作的,但是,对于如何处理 API 速率限制的任意方式,我仍然有点茫然。
具体来说,我试图做的是从曾经在我的广告帐户上运行的所有广告系列中检索所有广告集,无论它们的 effective_status
是否为 {{ 1}}、ACTIVE
、PAUSED
或 DELETED
。
因此,我为我的广告帐户提取了所有广告系列。它们存储在字典中,其中键表示 ARCHIVED
,就像这样,称为 effective_status
:
output
然后,我正在尝试提取广告集 ID,如下所示:
{''ACTIVE'': [''******************'',''******************'',''******************''],''PAUSED'': [''******************'',''******************''}
现在,每当我运行它时,它都会在不同的时间崩溃,并出现以下错误:
import pandas as pd
import json
import re
import time
from random import *
from facebook_business.api import FacebookAdsApi
from facebook_business.adobjects.adaccount import AdAccount # account-level info
from facebook_business.adobjects.campaign import Campaign # campaign-level info
from facebook_business.adobjects.adset import AdSet # ad-set level info
from facebook_business.adobjects.ad import Ad # ad-level info
# auth init
app_id = open(APP_ID_PATH,''r'').read().splitlines()[0]
app_secret = open(APP_SECRET_PATH,''r'').read().splitlines()[0]
token = open(APP_ACCESS_TOKEN,''r'').read().splitlines()[0]
# init the connection
FacebookAdsApi.init(app_id,app_secret,token)
campaign_types = list(output.keys())
ad_sets = {}
for status in campaign_types:
ad_sets_for_status = []
for campaign_id in output[status]:
# sleep and wait for a random time
sleepy_time = uniform(1,3)
time.sleep(sleepy_time)
# pull the ad_sets for this particular campaign
campaign_ad_sets = Campaign(campaign_id).get_ad_sets()
for entry in campaign_ad_sets:
ad_sets_for_status.append(entry[''id''])
ad_sets[status] = ad_sets_for_status
我无法重现它崩溃的时间,但是,它肯定不需要大约 600 次调用(请参阅此处:https://stackoverflow.com/a/29690316/5080858),而且正如您所看到的,我在每个API 调用。您可能会建议我只在 AdAccount 端点上调用 FacebookRequestError:
Message: Call was not successful
Method: GET
Path: https://graph.facebook.com/v11.0/23846914220310083/adsets
Params: {''summary'': ''true''}
Status: 400
Response:
{
"error": {
"message": "(#17) User request limit reached","type": "OAuthException","is_transient": true,"code": 17,"error_subcode": 2446079,"fbtrace_id": "***************"
}
}
方法,但是,即使在崩溃之前,这也比上述代码提取的广告集少。就我的用例而言,重要的是拉取已结束的广告和正在进行的广告,因此获取尽可能多的数据很重要。
我对此有点恼火——看到我们为这些广告的运行付费,你会认为 FB 会尽可能轻松地通过 API 检索它们的信息,而不是引入 API 速率限制类似于那些不一定拥有的有价值数据。
无论如何,我很感激任何形式的建议或见解 - 也许还有一种我没有考虑过的更好的方法来做到这一点。
非常感谢!
解决方法
''code'': 17
的错误意味着您达到了调用限制,为了获得更多节点,您必须等待。
首先我会以这种方式处理错误:
from facebook_business.exceptions import FacebookRequestError
...
for status in campaign_types:
ad_sets_for_status = []
for campaign_id in output[status]:
# keep trying until the request is ok
while True:
try:
campaign_ad_sets = Campaign(campaign_id).get_ad_sets()
break
except FacebookRequestError as error:
if error.api_error_code() in [17,80000]:
time.sleep(sleepy_time) # sleep for a period of time
for entry in campaign_ad_sets:
ad_sets_for_status.append(entry[''id''])
ad_sets[status] = ad_sets_for_status
此外,我还建议您从帐户中获取节点列表(通过使用 ''level'': node
中的 params
参数)并使用批处理调用:我可以向您保证会帮助你很多,它会减少程序运行时间。
希望对您有所帮助。
Facebook Marketing API 广告集创建返回空数组
如何解决Facebook Marketing API 广告集创建返回空数组
我想从 Facebook Marketin API 创建广告。我使用了官方文档。 所以在 adset 创建部分我遵循了这个文档 https://developers.facebook.com/docs/marketing-apis/get-started#ad-set-budget
发送请求后,我的响应返回为空数组:
为什么我收到这个错误。我该如何解决?
今天关于如何通过 Mailchimp Marketing API 用可重复的内容填充营销模板的介绍到此结束,谢谢您的阅读,有关API PUT /marketing/contacts/imports with restsharp、criteo marketing api 相关、Facebook Marketing API - 如何处理通过广告系列 ID 检索*所有*广告集的速率限制?、Facebook Marketing API 广告集创建返回空数组等更多相关知识的信息可以在本站进行查询。
本文标签: