Multiple Media Entities in Tweets for the REST API


#1

We are planning to launch support for multiple media entities in tweets via our REST API on May 28th. This will be exposed as a new extended_entities object in the JSON response.

Today the only type exposed in our entities is photo, however with the addition of extended_entities we plan to expand the types of media we expose. Developers should actively use the type attribute from the media exposed to validate you are handling the types properly, and ignore types that are not of type photo.

For details on the changes we’ll be making to support this feature, visit [node:27935]. We’ll Tweet from @TwitterAPI when we make the actual changes on the 28th.

Post your questions here or Tweet to @TwitterDev.


#2

Accessing to the Web page “Multiple Media Entities in Statuses” is denied when I signed into this site. I can read the page if I sign out.


#3

hmm, that’s odd - I checked the permissions and it should allow you to access the page when logged in. Will check whether there’s a caching issue.


#4

This will actually be released tomorrow, May 29th, during business hours (PDT).

We will slowly ramp up availability throughout the day.


#5

so it’s normal i can’t get mulitple photos in a tweet right now?


#6

Yes. I will update this thread when we start to ramp this up, we will roll it out gradually during the day.


#7

The roll out will be completed by the end of the day tomorrow (Friday May 30th, before 5pm PDT).


#8

You should start to see the extended_entities this morning, we are ramping this first. This afternoon we will enable POSTing.


#9

Posting multiple photos still doesn’t work:

$ twurl “/1.1/statuses/update.json” -d “media_ids=460938773744717825,460938635315916800&status=Combined.&trim_user=1”

{“errors”:[{“message”:“Internal error”,“code”:131}]}

And now https://dev.twitter.com/docs/api/multiple-media-extended-entities returns “Access denied”.

Is something going wrong?


#10

How does it look with the rollout? Unfortunately we are still unable to see extended_entities for tweets in the API. Should we wait or fill in a bug report?

Example request: https://apigee.com//snapshot/twitter?snapId=apigee-console-snapshots-1401598800000_862685cf-519f-488c-9344-72fe4d44acf8.

Thanks.


#11

This should be available to all now, please let us know if you are not seeing extended_entities or are not able to POST.

Docs are at https://dev.twitter.com/docs/api/multiple-media-extended-entities.


#12

Not sure if this is an issue with the apigee console, just tested it using twurl with the sample tweet in the docs (https://api.twitter.com/1.1/statuses/show.json?id=449660889793581056) and it worked for me.


#13

I am still not seeing extended_entities on getting statuses and the home_timelines.

Ex. Sorry for including non-English charactors.

opening connection to api.twitter.com…
opened
<- “GET /1.1/statuses/show.json?id=472840878000574465 HTTP/1.1\r\nAccept: /\r\nUser-Agent: OAuth gem v0.4.7\r\nAccept-Encoding: deflate, gzip\r\nAuthorization: OAuth oauth_consumer_key=”", oauth_nonce="", oauth_signature="", oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1401742274”, oauth_token="", oauth_version=“1.0”\r\nHost: api.twitter.com\r\n\r\n"
-> “HTTP/1.1 200 OK\r\n”
-> “cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0\r\n”
-> “content-encoding: gzip\r\n”
-> “content-length: 1521\r\n”
-> “content-type: application/json;charset=utf-8\r\n”
-> “date: Mon, 02 Jun 2014 20:51:15 GMT\r\n”
-> “expires: Tue, 31 Mar 1981 05:00:00 GMT\r\n”
-> “last-modified: Mon, 02 Jun 2014 20:51:15 GMT\r\n”
-> “pragma: no-cache\r\n”
-> “server: tfe\r\n”
-> “set-cookie: lang=ja\r\n”
-> “set-cookie: guest_id=v1%3A140174227503705055; Domain=.twitter.com; Path=/; Expires=Wed, 01-Jun-2016 20:51:15 UTC\r\n”
-> “status: 200 OK\r\n”
-> “strict-transport-security: max-age=631138519\r\n”
-> “x-access-level: read-write-directmessages\r\n”
-> “x-content-type-options: nosniff\r\n”
-> “x-frame-options: SAMEORIGIN\r\n”
-> “x-rate-limit-limit: 180\r\n”
-> “x-rate-limit-remaining: 179\r\n”
-> “x-rate-limit-reset: 1401743175\r\n”
-> “x-transaction: 87aa13c3c83c5bda\r\n”
-> “x-xss-protection: 1; mode=block\r\n”
-> “\r\n"
reading 1521 bytes…
-> “”
->
read 1521 bytes
Conn keep-alive
{
“contributors” => nil
"coordinates” => nil
"created_at" => “Sat May 31 20:43:44 +0000 2014"
“entities” =>
{
“hashtags” =>
[
]
“media” =>
[
{
“display_url” => “pic.twitter.com/aLKT9TExhw”
“expanded_url” => “http://twitter.com/nosuz/status/472840878000574465/photo/1"
“id” => 472840860376510465
"id_str” => “472840860376510465"
“indices” =>
[
115
137
]
“media_url” => “http://pbs.twimg.com/media/Bo_eQd4IMAESHd4.jpg”
“media_url_https” => “https://pbs.twimg.com/media/Bo_eQd4IMAESHd4.jpg”
“sizes” =>
{
“large” =>
{
“h” => 759
"resize” => “fit”
“w” => 1024
}
“medium” =>
{
“h” => 444
"resize” => “fit”
“w” => 599
}
“small” =>
{
“h” => 252
"resize" => “fit”
“w” => 340
}
“thumb” =>
{
“h” => 150
"resize" => “crop”
“w” => 150
}
}
“type” => “photo”
“url” => “http://t.co/aLKT9TExhw”
}
]
“symbols” =>
[
]
“urls” =>
[
]
“user_mentions” =>
[
]
}
“favorite_count” => 2
"favorited" => false
"geo" => nil
"id" => 472840878000574465
"id_str" => “472840878000574465"
“in_reply_to_screen_name” => nil
"in_reply_to_status_id” => nil
"in_reply_to_status_id_str" => nil
"in_reply_to_user_id" => nil
"in_reply_to_user_id_str" => nil
"lang" => “ja”
“place” => nil
"possibly_sensitive" => false
"retweet_count" => 1
"retweeted" => false
"source" => “<a href=“http://twitter.com/download/android” rel=“nofollow”>Twitter for Android”
“text” => “ガーデンテラスから六甲山までの道はツツジがとっても綺麗だった。盛りは 過ぎてたけど、こんなにツツジがあるとは知らなかった。この季節にこのコースを歩くの初めてだったかな?時記憶力が弱いと普段は困るけど、こおいう時は何度も驚けてお得。 http://t.co/aLKT9TExhw
“truncated” => false
"user" =>
{
“contributors_enabled” => false
"created_at" => “Fri May 27 22:31:46 +0000 2011"
“default_profile” => true
"default_profile_image” => false
"description" => “世界一周を目指し七つの言語(日本語 英語 Ruby PHP Java HTML SQL)を書き分けてどこまでも進みたいが、世界の果てだと思ったら最寄駅という井の中の蛙。週末は裏山で写真撮ったりハイキングしています。”
“entities” =>
{
“description” =>
{
“urls” =>
[
]
}
“url” =>
{
“urls” =>
[
{
“display_url” => “postcard.st/nosuz/
“expanded_url” => “http://www.postcard.st/nosuz/
“indices” =>
[
0
22
]
“url” => “http://t.co/dkcLmMpbLW
}
]
}
}
“favourites_count” => 70
"follow_request_sent" => false
"followers_count" => 260
"following" => false
"friends_count" => 344
"geo_enabled" => true
"id" => 306455217
"id_str" => “306455217"
“is_translation_enabled” => false
"is_translator” => false
"lang" => “ja”
“listed_count” => 11
"location" => “海と山の間”
“name” => “nosuz”
“notifications” => false
"profile_background_color" => “C0DEED”
“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_image_url" => “http://pbs.twimg.com/profile_images/1376935749/NSicon_normal.png
“profile_image_url_https” => “https://pbs.twimg.com/profile_images/1376935749/NSicon_normal.png
“profile_link_color” => “0084B4"
“profile_sidebar_border_color” => “C0DEED”
“profile_sidebar_fill_color” => “DDEEF6"
“profile_text_color” => “333333"
“profile_use_background_image” => true
"protected” => false
"screen_name” => “nosuz”
“statuses_count” => 13179
"time_zone” => “Osaka”
“url” => “http://t.co/dkcLmMpbLW
“utc_offset” => 32400
"verified" => false
}
}

Updating statuses with media_ids works and I can see the multiple photos on Web page, but the API results have no extended_entities, just only entities.

Thank you.


#14

Can I get extended_entities in the search/tweets and streams(I use statuses/sample)?
if not supported, is there any plans to support?


#15

can’t get multiple photos using api:
https://api.twitter.com/1.1/statuses/home_timeline.json

also tried
https://api.twitter.com/1.1/statuses/show/{id}.json

i have posted 3 pictures in this tweet, but i can only get one in media section, and no extended_media in reposonse

“media”: [
{
“id”: 473655124855111700,
“id_str”: “473655124855111681”,
“indices”: [
0,
22
],
“media_url”: “http://pbs.twimg.com/media/BpLC05cIQAEVGoN.png”,
“media_url_https”: “https://pbs.twimg.com/media/BpLC05cIQAEVGoN.png”,
“url”: “http://t.co/IZmkq3vmxG”,
“display_url”: “pic.twitter.com/IZmkq3vmxG”,
“expanded_url”: “http://twitter.com/iAutoApps/status/473655129678155777/photo/1”,
“type”: “photo”,
“sizes”: {
“medium”: {
“w”: 18,
“h”: 18,
“resize”: “fit”
},
“thumb”: {
“w”: 18,
“h”: 18,
“resize”: “crop”
},
“large”: {
“w”: 18,
“h”: 18,
“resize”: “fit”
},
“small”: {
“w”: 18,
“h”: 18,
“resize”: “fit”
}
}
}
]
},


#16

I’m also not able to retrieve extended_entities from my app (I’m using Twitter4j).
Using twurl I can see the new object, but when I perform the same request from my app I get a different JSON response (I’m using the same consumer key & secret, if that can help).

twurl /1.1/statuses/show/470059593737846785.json

(I’m also getting an “Access Denied” error on the documentation page, but only when I’m logged in).


#17

Is this available to everyone or only to specific partners.
When i tried using this API, i got “Internal Service Error” with it.

REQUEST

POST /1.1/statuses/update.json?status=tt1&display_coordinates=false&media_ids=473779467069173760,473779756484542460 HTTP/1.1

X-HostCommonName:
api.twitter.com
Authorization:
OAuth oauth_consumer_key=“DC0sePOBbQ8bYdC8r4Smg”,oauth_signature_method=“HMAC-SHA1”,oauth_timestamp=“1401792930”,oauth_nonce=“2761693087”,oauth_version=“1.0”,oauth_token=“322472919-rJFyTe8VhpzwgABeJLHEZmF7uWwP7xzgpAHu0o8L”,oauth_signature="lIGtzDLvz3PCksbf%2BXkvuPqdmYQ%3D"
Host:
api.twitter.com
Content-Length:
0
X-Target-URI:
https://api.twitter.com
Content-Type:
application/x-www-form-urlencoded; charset=UTF-8
Connection:
Keep-Alive

===========

RESPONSE

HTTP/1.1 500 Internal Server Error

x-frame-options:
SAMEORIGIN
content-type:
application/json; charset=utf-8
last-modified:
Tue, 03 Jun 2014 10:55:30 GMT
status:
500 Internal Server Error
date:
Tue, 03 Jun 2014 10:55:30 GMT
x-transaction:
123c19cd017d1f8e
pragma:
no-cache
cache-control:
no-cache, no-store, must-revalidate, pre-check=0, post-check=0
x-xss-protection:
1; mode=block
x-content-type-options:
nosniff
expires:
Tue, 31 Mar 1981 05:00:00 GMT
set-cookie:
lang=en
set-cookie:
guest_id=v1%3A140179293064373993; Domain=.twitter.com; Path=/; Expires=Thu, 02-Jun-2016 10:55:30 UTC
content-length:
52
server:
tfe
strict-transport-security:
max-age=631138519
x-access-level:
read-write-directmessages

{
“errors”: [
{
“message”: “Internal error”,
“code”: 131
}
]
}


#18

Hi Sylvain,
thanks for you reply. Well, after more testing we found out that it actually depends (or it seems to be the reason at least) on used oauth access tokens. With some of them extended_entities are present in the response and with some of them not. Is anybody else seeing the same behavior?


#19

Suggest looking at RiteTag API - http://ritetag.com/rest-api for hashtag-grading and associated hashtags.


#20

I’m not seeing extended_entities coming back in many cases too, showing fine on Web but not when querying the API directly