Not getting 'card' key in API response for vines and videos support

android
vine

#1

Hi,
I am working on an android application which displays tweets in a list and want to show vines and videos in the list itself(instead of links).
I have updated my android tweetui sdk to 1.11.1 and twitter sdk to 14.1.1 to include the new rich media feature introduces last week, blog link.

I am using [ https://dev.twitter.com/rest/reference/get/statuses/show/%3Aid] for API response(Tweet JSON).
But I don’t get any ‘card’ key in my response, which is required by the BaseTweetView.java class.

For all the vines and videos the below condition fails:
if (displayTweet.card != null && VineCardUtils.isVine(displayTweet.card))

Any help regarding this will be highly appreciated.


#2

Hey @akshaygoyal174,

Can you share your app identifier so that I can look into this further? Also, can you share some of the tweet ids you’re seeing this on?

Thanks,
Mike


#3

Hi @bonnell,
If you’d not mind, I’d be willing to share the the app identifier privately.
I debugged the library code, and it fails here displayTweet.card != null because displayTweet.card is null from the response.

I am pretty sure this is an API response issue.
Do you guys send ‘card’ as a key in API response? Because I was unable to find it in the documentation as well. but the app expects it.
Code snippet from Tweet.java
/**
* Nullable. Card data used to attach rich photos, videos and media experience to Tweets.
*/
@SerializedName(“card”)
public final Card card;

Some tweet id’s:
755915269982171100
755835044460007400
755923687694561300
756038717987549200


#4

It sounds like your app ID isn’t enabled for the correct permissions on our side - if you can share your app ID with us via support@fabric.io and reference this thread, then we can look into that for you.


#5

sent an email. Please revert asap.


#6

The Tweet IDs you provided do not exist.

Tweet with Vine:
https://twitter.com/vine/status/756224775131848705


#7

Are those Tweet IDs from the id or the id_str field? please provide id_str - thanks!


#8

id_str:

756224775131848705
755915269982171137
586671909
2769222833
756029701919956992


#9

I used this tweet as you suggested but get a card with url and not the expanded vine.


#10

Let me clarify my question:
I am using statuses/show/:id to fetch Tweet data.

Sample tweet data:

"tweet": {
"contributors": null,
"truncated": false,
"text": "⚡️⚡️⚡️ https://t.co/SV1IGKOOFX",
"is_quote_status": false,
"in_reply_to_status_id": null,
"id": 756224775131848700,
"favorite_count": 3380,
"source": "<a href=\"https://about.twitter.com/products/tweetdeck\" rel=\"nofollow\">TweetDeck</a>",
"retweeted": false,
"coordinates": null,
"entities": {
"symbols": [],
"user_mentions": [],
"hashtags": [],
"urls": [
{
"url": "https://t.co/SV1IGKOOFX",
"indices": [
7,
30
],
"expanded_url": "https://vine.co/v/5ZvYFWa9AFr",
"display_url": "vine.co/v/5ZvYFWa9AFr"
}
]
},
"html": "<blockquote class=\"twitter-tweet\"><p lang=\"und\" dir=\"ltr\">⚡️⚡️⚡️ <a href=\"https://t.co/SV1IGKOOFX\">https://t.co/SV1IGKOOFX</a></p>&mdash; Vine (@vine) <a href=\"https://twitter.com/vine/status/756224775131848705\">July 21, 2016</a></blockquote>\n",
"in_reply_to_screen_name": null,
"in_reply_to_user_id": null,
"retweet_count": 1894,
"id_str": "756224775131848705",
"favorited": false,
"user": {},
"geo": null,
"in_reply_to_user_id_str": null,
"possibly_sensitive": false,
"possibly_sensitive_appealable": false,
"lang": "und",
"created_at": "Thu Jul 21 20:30:11 +0000 2016",
"in_reply_to_status_id_str": null,
"place": null
}

Now, there is no key as ‘card’ in the above response.

Ques1: What do I want to do.
Ans: Render vine-tweets in a sync manner with expanded vines/videos. (blog link)

Ques2: Why do I need the ‘card’ key? Ans: Because when I pass the above JSON to the TweetView using:

new TweetView(context, tweetData);

Inside the render() function of the BaseTweetView.java is called setTweetMedia(), which required a card object to render vines.

void render() {
   ....
    setTweetMedia(displayTweet);
    ....
}

final void setTweetMedia(Tweet displayTweet) {
    //my value for displayTweet.card == null
    if (displayTweet.card != null && VineCardUtils.isVine(displayTweet.card)) {
        ....
    } else if (TweetMediaUtils.hasSupportedVideo(displayTweet)) {
        ....
    }
    ....
}

Therefore I feel that the API response should contain card key.
Please help with this.


#11

Is the API key you’re using one that you’ve added to the app yourself (from apps.twitter.com), or is it an API key included as part of the Fabric Twitter Kit setup process?


#12

I am using API key from apps.twitter.com.
We have been using this key since, before developing the android app.
Now we are using the same endpoint to send the tweet data to the app as well.


#13

In that case you’ll need to share that key with support@Fabric.io (I noted that you emailed them last week) for them to help you with this. Vine displays are configured automatically for Fabric keys, but we’ll need to help you outside of that.