How to get Card ID from Tweet ID?


#1

Hi, this is a question about using Advertising API GETs on existing tweets. We are trying to determine what the Card ID is from a known Tweet ID using the Advertising API.

We are able to retrieve the following data from the advertising api:

  • account id
  • campaign id
  • line id
  • promoted tweet id
  • tweet id

But how do we actually get the card id with this information? Is there a GET call on the Advertising API we can make to retrieve this?

Our current work around is to use the Tweet ID on the status API to get the preview_url (typo: expanded_url) which we can parse for the card ID, but it seems strange to us that we’d have to jump over to a completely different api to get this data.


PromotedTweetからCard情報を取得する方法について
#2

Hi,

We would normally advise to save the card URL in a mapping on your end, but it can also be retrieved via the tweet object’s expanded_url like “https://cards.twitter.com/cards/e6jdf3/hju3” (hju3 would be card ID).

Thanks,
John


#3

Typo in my last post. Our current work around is parsing expanded_url on https://api.twitter.com/1.1/statuses/show.json?id=TWEET_ID

Sounds like that’s the only way. I assume the risk is if/when we ever delete any tweet, then this call won’t work. The only way to be complete will be to store it. Is that right?

Thanks.


#4

Jep, parsing the extended url is the approach I use to get the card ids too.