The "card_uri" property of "scheduled_tweets" API shows the "null" value

cards

#1

The “card_uri” property of “scheduled_tweets” API shows the “null” value,
Shouldn’t it be the card URI ?

twurl -H “https://ads-api.twitter.com” “/2/accounts/18ce54iditw/scheduled_tweets?user_id=870127656477483008”

{
  "completed_at": null,
  "id_str": "913323422096097280",
  "text": "https://cards.twitter.com/cards/18ce54iditw/4rbli ",
  "user_id": "870127656477483008",
  "scheduled_status": "SCHEDULED",
  "id": 913323422096097300,
  "media_ids": [],
  "nullcast": false,
  "created_at": "2017-09-28T08:44:07Z",
  "scheduled_at": "2017-12-30T09:00:00Z",
  "card_uri": null,
  "updated_at": "2017-09-28T08:44:07Z",
  "tweet_id": null
}

#2

To associate a card_uri-card with a Scheduled Tweet, use the card_uri parameter. See the following example.

$ twurl -X POST -H ads-api.twitter.com "/2/accounts/18ce54d4x5t/scheduled_tweets?scheduled_at=2017-10-05&text=website card&as_user_id=756201191646691328&card_uri=card://915245880013234177"
{
  "request": {
    "params": {
      "text": "website card",
      "scheduled_at": "2017-10-05T00:00:00Z",
      "as_user_id": 756201191646691328,
      "card_uri": "card://915245880013234177"
    }
  },
  "data": {
    "completed_at": null,
    "id_str": "915287083178008576",
    "text": "website card",
    "user_id": "756201191646691328",
    "scheduled_status": "SCHEDULED",
    "id": 915287083178008576,
    "media_ids": [],
    "nullcast": true,
    "created_at": "2017-10-03T18:47:00Z",
    "scheduled_at": "2017-10-05T00:00:00Z",
    "card_uri": "card://915245880013234177",
    "updated_at": "2017-10-03T18:47:00Z",
    "tweet_id": null,
    "media_keys": []
  }
}

Currently, both video website and website cards support card_uri.


#3

Thanks for the reply.
But you don’t get what I have asked.

I meant that even the scheduled tweet has been associated with a card,
The “card_uri” property get “null” when I call “/2/accounts/18ce54iditw/scheduled_tweets" .

scheduled_tweets


#4

You’ve associated the card by passing in its preview_url as the text value when creating the Scheduled Tweet. This is a valid approach and works for non-scheduled Tweets, too.

However, when using this approach, the card_uri response attribute is not returned. This is by design. You’ll only see the card_uri response attribute in Scheduled Tweets when using the card_uri request parameter on create (or update), as shown in the example above.

Hope this helps clarify things.


#5

Thanks for the quick reply.


#6

@juanshishido
What’s the difference of relation between card_uri and card_id?
How to get the card detail by card_uri ?

Thanks in advance.


#7

@wenping.wang: The card’s id is it’s current identifier. When using either of our GET endpoints, you can either filter by card IDs (using the card_ids request parameter) or view a single specific card, by appending the card ID to the resource path.

As know, we’re migrating to using card_uri. To use cards that have this value, you pass the card URI as the request parameter value when creating Tweets or Scheduled Tweets.

We don’t currently have a way to retrieve cards by card_uri, but we’re thinking about it. It’d helpful if you could describe some example use cases for when you’d need this and detail how it’d be used.

Thanks!


#8

@juanshishido

Thanks for the reply.
I’ve got what you have replied.

My use case is that I want to get the card details of Scheduled Tweet?
But it seems that the card_id could only be found in the text like below,
Even I have known the card_id, I don’t know it’s card type ,
which one is used to call card API, like cards/website/{card_id}

    {
      "completed_at": null,
      "id_str": "930430586212073472",
      "text": "UIから予約投稿ツイートテスト https://cards.twitter.com/cards/18ce54ikttl/4mbp2",
      "user_id": "865426208527237125",
      "scheduled_status": "SCHEDULED",
      "id": 930430586212073500,
      "media_ids": [],
      "nullcast": true,
      "created_at": "2017-11-14T13:41:52Z",
      "scheduled_at": "2017-12-30T15:00:00Z",
      "card_uri": null,
      "updated_at": "2017-11-14T13:42:24Z",
      "tweet_id": null,
      "media_keys": []
    }```

#9

@juanshishido Do you have an idea about the above?


#10

You raise a good point, @wenping.wang. We don’t currently have a way to lookup a card without first knowing what type of card it is (e.g., image app download or video website).

We’ll log this as a feature request. Thank you for raising this!