Thanks for your comment, @mcrwebdesign.
When calling the GET /1/stats/accounts/:account_id endpoint, you do not need to specify the campaign objective. Below is an example request using twurl.
$ twurl -H ads-api.twitter.com "/1/stats/accounts/xxxxx?entity=CAMPAIGN&entity_ids=1abc2&start_time=2016-09-01&end_time=2016-09-02&granularity=DAY&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER" | jq
{
"data_type": "stats",
"time_series_length": 1,
"data": [
{
"id": "1abc2",
"id_data": [
{
"segment": null,
"metrics": {
"impressions": [
140
],
"tweets_send": null,
"qualified_impressions": null,
"follows": [
3
],
"app_clicks": null,
"retweets": null,
"likes": [
21
],
"engagements": [
2006
],
"clicks": [
140
],
"card_engagements": null,
"replies": null,
"url_clicks": [
99
],
"carousel_swipes": null
}
}
]
}
],
"request": {
"params": {
"start_time": "2016-09-01T00:00:00Z",
"segmentation_type": null,
"entity_ids": [
"1abc2"
],
"end_time": "2016-09-02T00:00:00Z",
"country": null,
"placement": "ALL_ON_TWITTER",
"granularity": "DAY",
"entity": "CAMPAIGN",
"platform": null,
"metric_groups": [
"ENGAGEMENT"
]
}
}
}
If you need to access the objective, you do this at the line item-level. For a specific campaign:
$ twurl -H ads-api.twitter.com "/1/accounts/xxxxx/line_items?campaign_ids=9z87y" | jq
{
"request": {
"params": {
"account_id": "xxxxx",
"campaign_ids": [
"9z87y"
]
}
},
"data": [
{
"bid_type": "MAX",
"advertiser_user_id": 123456789987654321,
"name": "Untitled",
"placements": [
"ALL_ON_TWITTER"
],
"start_time": null,
"bid_amount_local_micro": 5000000,
"automatically_select_bid": false,
"advertiser_domain": null,
"primary_web_event_tag": null,
"charge_by": "ENGAGEMENT",
"product_type": "PROMOTED_TWEETS",
"end_time": null,
"bid_unit": "ENGAGEMENT",
"total_budget_amount_local_micro": null,
"objective": "TWEET_ENGAGEMENTS",
"id": "5hijk",
"paused": false,
"account_id": "xxxxx",
"optimization": "DEFAULT",
"categories": [],
"currency": "USD",
"created_at": "2016-07-15T00:00:00Z",
"tracking_tags": [],
"updated_at": "2016-07-15T00:00:00Z",
"include_sentiment": "POSITIVE_ONLY",
"campaign_id": "9z87y",
"creative_source": "MANUAL",
"deleted": false
}
],
"data_type": "line_item",
"total_count": 1,
"next_cursor": null
}
Here, you can see that this campaign has a TWEET_ENGAGEMENTS objective. Every line item under a campaign must share the same objective type, @majoritasdev mentioned earlier.