How to get all ads image and ads text from campaign

ads
api

#1

Hello !

I am newbie in Twitter Ads API.
I am trying to get ads image and ads text from some special campaign but i didnot find any way to do that.
Please advise.


#2

Hi LeTung.

Can you provide more detail of what you’re doing here? Not sure what a special campaign is.

If you’re attempting to get image + text off a tweet, you may be able to query the tweet directly, using one of the following two APIs:


#3

Hi @rchoi

My work is from campaign id, get list of creative image and ads text.
i saw that i can get image of the card with https://dev.twitter.com/ads/creative
but how to get the card associate with campaign id ?
and if the promoted tweet didnot use card, how can i get ads text and image from campaign id ?


#4

Thanks for the quick reply!

If you’re starting with campaign ID, i believe you’ll need to do a bit of traversal. Specifically:

1.) A campaign has multiple line items
2.) Each line item item is associated to tweets (perhaps all the same, perhaps different) via a promoted_tweet

Therefore, if you are starting with the campaign ID, you can get line items with this call:

https://dev.twitter.com/ads/reference/get/accounts/%3Aaccount_id/line_items

And once you have the set of all line items, you can get the promoted tweets (and therefore the tweets) by line items in this call:

https://dev.twitter.com/ads/reference/get/accounts/%3Aaccount_id/promoted_tweets

Then you can get the tweets themselves with this call:

https://dev.twitter.com/rest/reference/get/statuses/show/%3Aid

The only remaining (and tricky) part is that we don’t have an easy tweet-to-card lookup. You can get the http URL from the tweet itself, parse out the ID, and do a reverse lookup of the card with the specific card detail call:

https://dev.twitter.com/ads/creative


How to get all ads image and ads text from campaign
#5

Thank you @rchoi

It is very helpful for me.

I will try it right now.


#6

This topic was automatically closed after 24 hours. New replies are no longer allowed.