Twitter Chunk Upload STATUS COMMAND call fails


#1

I am using https://upload.twitter.com/1.1/media/upload.json
using https://dev.twitter.com/rest/public/uploading-media#chunkedupload

INIT - works fine
APPEND- works fine
FINALIZE - works fine

STATUS - errors out
with [status code] 500
[reason phrase] Internal Server Error

I tried sleep(5); sleeps for 5 seconds and again trying to get STATUS for 5 times, still not working?
any idea???


#2

Moving this to the Media API category.

Can you tell us any more about what file you’re uploading, the language or library you’re using, and show us any headers and responses from the API?


#3

I am using PHP Guzzle client

INIT:
POST https://upload.twitter.com/1.1/media/upload.json

Request Headers:
Host: upload.twitter.com
User-Agent: Guzzle/3.9.3 curl/7.19.7 PHP/5.3.3
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Authorization: [SANITIZED]
Request Post Fields:
command: INIT
media_type: video/mp4
total_bytes: 73139

APPEND:
POST https://upload.twitter.com/1.1/media/upload.json

Request Headers:
Host: upload.twitter.com
User-Agent: Guzzle/3.9.3 curl/7.19.7 PHP/5.3.3
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Authorization: [SANITIZED]
Request Post Fields:
command: APPEND
media_id: 702549577266638848
segment_index: 0

FINALIZE:

POST https://upload.twitter.com/1.1/media/upload.json

Request Headers:
Host: upload.twitter.com
User-Agent: Guzzle/3.9.3 curl/7.19.7 PHP/5.3.3
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Authorization: [SANITIZED]
Request Post Fields:
command: FINALIZE
media_id: 702549577266638848

Works fine till this point

STATUS:
GET https://upload.twitter.com/1.1/media/upload.json?command=STATUS&media_id=702549577266638848

Request Headers:
Host: upload.twitter.com
User-Agent: Guzzle/3.9.3 curl/7.19.7 PHP/5.3.3
Authorization: [SANITIZED]

getting,
2016-02-24T17:46:07+00:00 request_id=6335f525-366c-4c78-bca1-a05d85aae22c, pid=16782, datetime=2016-02-24T17:46:07+00:00, channel=app, priority=INFO, message="Response Headers:
HTTP/1.1 500 Internal Server Error
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
content-disposition: attachment; filename=json.json
content-length: 52
content-type: application/json;charset=utf-8
date: Wed, 24 Feb 2016 17:46:07 GMT
expires: Tue, 31 Mar 1981 05:00:00 GMT
last-modified: Wed, 24 Feb 2016 17:46:07 GMT
pragma: no-cache
server: tsa_a
set-cookie: lang=en; Path=/, guest_id=v1%3A145633596740909047; Domain=.twitter.com; Path=/; Expires=Fri, 23-Feb-2018 17:46:07 UTC
status: 500 Internal Server Error
strict-transport-security: max-age=631138519
vary: Origin
x-access-level: read-write-directmessages
x-connection-hash: 256ea07e67748e60775d33822895c08e
x-frame-options: SAMEORIGIN
x-response-time: 306
x-transaction: fbe91171dbf08d74
x-twitter-response-tags: BouncerCompliant
x-xss-protection: 1; mode=block

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

But when I publish without using status scripts it posts the tweet !
https://twitter.com/shrey_tweet


#4

How many chunks are you sending?

It sounds like you’re not doing the async video upload so the STATUS command is redundant.


#5

This video has only one chunk because of small video size


#6

In that case, if I understand things correctly the STATUS command should not be required (as you’re finding, since the Tweet is working correctly).


#7

Can you provide a link to the media?

Additionally, we have sample code you can use:

And we have a tool that you can try yourself:

https://django-rest-apis.herokuapp.com/media

It will show the request/response for chunked uploads, which I recommend using regardless.


#8

Ok… got it… not using status command and I am fine with it now ! thanks


#9