Good afternoon,
I am using the Advertiser APIs quite extensively I have been receiving intermittent errors when attempting to create Line Items. Often the error will happen once and then after a delay of 15s the same request will work.
For Example on Nov 13th I attempted to create a large number of targeted line items. First I created a Campaign with an id of bp9t8
{
"Campaign": {
"url": "https://ads-api.twitter.com/4/accounts/18ce54skfk4/campaigns",
"request": {
"params": {
"daily_budget_amount_local_micro": 1000000000,
"funding_instrument_id": "private",
"entity_status": "ACTIVE",
"name": "US-twitter-part1-2018-11-13",
"start_time": "2018-11-13"
}
},
"response": {
"data": {
"name": "US-twitter-part1-2018-11-13",
"start_time": "2018-11-13T00:00:00Z",
"reasons_not_servable": [
"INCOMPLETE"
],
"servable": false,
"daily_budget_amount_local_micro": 1000000000,
"end_time": null,
"funding_instrument_id": "private",
"duration_in_days": null,
"standard_delivery": true,
"total_budget_amount_local_micro": null,
"id": "bp9t8",
"entity_status": "ACTIVE",
"account_id": "18ce54skfk4",
"frequency_cap": null,
"currency": "USD",
"created_at": "2018-11-13T15:56:47Z",
"updated_at": "2018-11-13T15:56:47Z",
"deleted": false
},
"request": {
"params": {
"name": "US-twitter-part1-2018-11-13",
"start_time": "2018-11-13T00:00:00Z",
"daily_budget_amount_local_micro": 1000000000,
"funding_instrument_id": "private",
"entity_status": "ACTIVE",
"account_id": "18ce54skfk4"
}
}
}
}
I have removed some identifying information from the name and the funding_instrument_id but other wise params is what is appended to url and response is what came back.
Then I attempted to add an ad group:
{
"CreateLineItem": {
"url": "https://ads-api.twitter.com/4/accounts/18ce54skfk4/line_items",
"request": {
"params": {
"account_id": "18ce54skfk4",
"campaign_id": "bp9t8",
"name": "US-2018-11-13",
"objective": "APP_INSTALLS",
"placements": "ALL_ON_TWITTER",
"product_type": "PROMOTED_TWEETS",
"bid_type": "MAX",
"bid_unit": "APP_INSTALL",
"entity_status": "ACTIVE",
"bid_amount_local_micro": 4000000
}
},
"response": {
"errors": [
{
"code": "INVALID",
"message": "LineItem ChargeBy ENGAGEMENTS requires BidUnit to be CPE",
"attribute": "charge_by"
}
],
"request": {
"params": {
"bid_type": "MAX",
"name": "US-2018-11-13",
"placements": [
"ALL_ON_TWITTER"
],
"bid_amount_local_micro": 4000000,
"product_type": "PROMOTED_TWEETS",
"bid_unit": "APP_INSTALL",
"objective": "APP_INSTALLS",
"entity_status": "ACTIVE",
"account_id": "18ce54skfk4",
"campaign_id": "bp9t8"
}
}
}
}
}
Then the code slept for 15s and tried again with the same request body and url:
{
"CreateLineItem": {
"url": "https://ads-api.twitter.com/4/accounts/18ce54skfk4/line_items",
"request": {
"params": {
"account_id": "18ce54skfk4",
"campaign_id": "bp9t8",
"name": "US-2018-11-13",
"objective": "APP_INSTALLS",
"placements": "ALL_ON_TWITTER",
"product_type": "PROMOTED_TWEETS",
"bid_type": "MAX",
"bid_unit": "APP_INSTALL",
"entity_status": "ACTIVE",
"bid_amount_local_micro": 4000000
}
},
"response": {
"data": {
"bid_type": "MAX",
"advertiser_user_id": 27472675,
"name": "US-2018-11-13",
"placements": [
"ALL_ON_TWITTER"
],
"start_time": null,
"bid_amount_local_micro": 4000000,
"automatically_select_bid": false,
"advertiser_domain": null,
"target_cpa_local_micro": null,
"primary_web_event_tag": null,
"charge_by": "APP_CLICK",
"product_type": "PROMOTED_TWEETS",
"end_time": null,
"bid_unit": "APP_INSTALL",
"total_budget_amount_local_micro": null,
"objective": "APP_INSTALLS",
"id": "cwhso",
"entity_status": "ACTIVE",
"account_id": "18ce54skfk4",
"optimization": "DEFAULT",
"categories": [],
"currency": "USD",
"created_at": "2018-11-13T16:00:41Z",
"tracking_tags": [],
"updated_at": "2018-11-13T16:00:41Z",
"include_sentiment": "POSITIVE_ONLY",
"campaign_id": "bp9t8",
"creative_source": "MANUAL",
"deleted": false
},
"request": {
"params": {
"bid_type": "MAX",
"name": "US-2018-11-13",
"placements": [
"ALL_ON_TWITTER"
],
"bid_amount_local_micro": 4000000,
"product_type": "PROMOTED_TWEETS",
"bid_unit": "APP_INSTALL",
"objective": "APP_INSTALLS",
"entity_status": "ACTIVE",
"account_id": "18ce54skfk4",
"campaign_id": "bp9t8"
}
}
}
}
}
As you can see this succeeded and began serving ads.
Then an additional ~70 or line items which are identical except for have names relevant to their targeting are added with out incident.
Then error happens a few more times for this campaign, but each time it was successfully added after retry.
As the day went on more campaigns were created, as a result of the 100 Line Items per Campaign limitation.
Finally, campaign bpb0n was created, which other than name is exactly the same as the above bp9t8 campaign. This campaign the errors became more common. sometimes happening 2 or 3 times per line item before succeeding. Eventually after 67 line items, the error became constant, and after 5 attempts for each line item the code aborted.
For example:
{
"CreateLineItem": {
"url": "https://ads-api.twitter.com/4/accounts/18ce54skfk4/line_items",
"request": {
"params": {
"account_id": "18ce54skfk4",
"campaign_id": "bpb0n",
"name": "US-2018-11-13",
"objective": "APP_INSTALLS",
"placements": "ALL_ON_TWITTER",
"product_type": "PROMOTED_TWEETS",
"bid_type": "MAX",
"bid_unit": "APP_INSTALL",
"entity_status": "ACTIVE",
"bid_amount_local_micro": 4000000
}
},
"response": {
"errors": [
{
"code": "INVALID",
"message": "LineItem ChargeBy ENGAGEMENTS requires BidUnit to be CPE",
"attribute": "charge_by"
}
],
"request": {
"params": {
"bid_type": "MAX",
"name": "US-2018-11-13",
"placements": [
"ALL_ON_TWITTER"
],
"bid_amount_local_micro": 4000000,
"product_type": "PROMOTED_TWEETS",
"bid_unit": "APP_INSTALL",
"objective": "APP_INSTALLS",
"entity_status": "ACTIVE",
"account_id": "18ce54skfk4",
"campaign_id": "bpb0n"
}
}
}
}
}
As you can see nothing changed between the items that worked and those that did not.
Please advice.
Thank you,
Matt Haag