Hi I’m experiencing a really strange behaviour trying to use a GIF.
I’m using the https://dev.twitter.com/rest/media/uploading-media#gifrecs to upload the GIF.
I’m following the next steps:
Request INIT
twurl -H upload.twitter.com -d "command=INIT&media_type=image/gif&media_category=tweet_gif&total_bytes=12237" '/1.1/media/upload.json'
Response INIT
{
"expires_after_secs": 86400,
"media_id": 732527250793455619,
"media_id_string": "732527250793455619"
}
Request APPEND
twurl -H upload.twitter.com -d "command=APPEND&media_id=732527250793455619&segment_index=0&media_data=MEDIADATA" '/1.1/media/upload.json'
Response APPEND
NULL
Request FINALIZE
twurl -H upload.twitter.com -d "command=FINALIZE&media_id=732527250793455619" '/1.1/media/upload.json'
Response FINALIZE
{
"expires_after_secs": 86400,
"media_id": 732527250793455619,
"media_id_string": "732527250793455619",
"processing_info": {
"check_after_secs": 5,
"state": "pending"
},
"size": 12237
}
Request STATUS
twurl -H upload.twitter.com '/1.1/media/upload.json?command=STATUS&media_id=732527250793455619'
Response STATUS
{
"expires_after_secs": 86363,
"media_id": 732527250793455619,
"media_id_string": "732527250793455619",
"processing_info": {
"progress_percent": 100,
"state": "succeeded"
},
"size": 12237
}
So, here, I’ve the GIF uploaded and ready to use, if I create a Tweet with this media_id all works fine:
Request Tweet
twurl -H ads-api.twitter.com -d "status=test&media_ids=732527250793455619" '/1/accounts/18ce53yv4fv/tweet'
Response Tweet
{
"data": {
"contributors": null,
"coordinates": null,
"created_at": "Tue May 17 11:09:42 +0000 2016",
"entities": {
"hashtags": [],
"symbols": [],
"urls": [
{
"display_url": "pic.twitter.com/vKVzrmfo9E",
"expanded_url": "http://twitter.com/TTechMarketing/status/732528517376806912/photo/1",
"indices": [
5,
28
],
"url": "https://t.co/vKVzrmfo9E"
}
],
"user_mentions": []
},
"favorite_count": 0,
"favorited": false,
"geo": null,
"id": 732528517376806912,
"id_str": "732528517376806912",
"in_reply_to_screen_name": null,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"lang": "en",
"place": null,
"possibly_sensitive": false,
"retweet_count": 0,
"retweeted": false,
"scopes": {
"followers": false
},
"source": "<a href=\"http://www.cyberclick.net\" rel=\"nofollow\">Twitter Tech Marketing</a>",
"text": "test https://t.co/vKVzrmfo9E",
"truncated": false,
"user": {
"contributors_enabled": false,
"created_at": "Mon Mar 23 12:39:26 +0000 2015",
"default_profile": false,
"default_profile_image": false,
"description": "#TwitterAds RESULTS driven through Artificial Intelligence #advertising #marketing",
"favourites_count": 81,
"follow_request_sent": false,
"followers_count": 32,
"following": false,
"friends_count": 75,
"geo_enabled": false,
"has_extended_profile": false,
"id": 3107536397,
"id_str": "3107536397",
"is_translation_enabled": false,
"is_translator": false,
"lang": "en-gb",
"listed_count": 4,
"location": "Barcelona, Espa\u00f1a",
"name": "T2M",
"notifications": false,
"profile_background_color": "000000",
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_tile": false,
"profile_banner_url": "https://pbs.twimg.com/profile_banners/3107536397/1458562317",
"profile_image_url": "http://pbs.twimg.com/profile_images/711888018517434368/NyS1fVF8_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/711888018517434368/NyS1fVF8_normal.jpg",
"profile_link_color": "0084B4",
"profile_sidebar_border_color": "000000",
"profile_sidebar_fill_color": "000000",
"profile_text_color": "000000",
"profile_use_background_image": false,
"protected": false,
"screen_name": "TTechMarketing",
"statuses_count": 35,
"time_zone": "Eastern Time (US & Canada)",
"url": "http://t2m.cyberclick.net",
"utc_offset": -14400,
"verified": false
}
},
"data_type": "status",
"request": {
"params": {
"account_id": "18ce53yv4fv",
"media_ids": [
732527250793455619
],
"status": "test"
}
}
}
But if I try to create an account_media object with the same ID It doesn’t work:
Request Account Media
twurl -H ads-api.twitter.com -d "creative_type=BANNER&media_id=732527250793455619" '/1/accounts/18ce53yv4fv/account_media'
Response Account Media
{
"errors": [
{
"code": "INVALID_MEDIA_ID",
"message": "Media referenced by media_id 732527250793455619 was not found."
}
],
"request": {
"params": {
"account_id": "18ce53yv4fv",
"creative_type": "BANNER",
"media_id": 732527250793455619
}
}
}
The expected Behaviour is like in the Twitter Ads UI, where you can usea a GIF in a account_media_creative as I’ve uploaded before:
Request Account Media GET
twurl -H https://ads-api.twitter.com '/1/accounts/18ce53yv4fv/account_media'
Response Account Media GET
{
"data": [
{
"account_id": "18ce53yv4fv",
"created_at": "2016-05-09T11:56:21Z",
"creative_type": "INTERSTITIAL",
"deleted": false,
"id": "14v5",
"media_url": "https://pbs.twimg.com/media-preview/729641149355442176/rOa0opMv.jpg",
"updated_at": "2016-05-09T11:56:21Z",
"video_id": null
},
{
"account_id": "18ce53yv4fv",
"created_at": "2016-05-11T15:09:25Z",
"creative_type": "BANNER",
"deleted": false,
"id": "15j7",
"media_url": "https://ton.twimg.com/tpn_gif/3107536397/1462979365162.gif",
"updated_at": "2016-05-11T15:09:25Z",
"video_id": null
},
{
"account_id": "18ce53yv4fv",
"created_at": "2016-05-11T15:13:03Z",
"creative_type": "INTERSTITIAL",
"deleted": false,
"id": "15j9",
"media_url": "https://ton.twimg.com/tpn_gif/3107536397/1462979581708.gif",
"updated_at": "2016-05-11T15:13:03Z",
"video_id": null
}
],
"data_type": "account_media",
"next_cursor": null,
"request": {
"params": {
"account_id": "18ce53yv4fv"
}
},
"total_count": 3
}
Any help will be appreciated