Custom Video API Call Returns 404 on Init



Hello I’m Attempting to post a video to Twitter using the endpoint using fabric’s extensible endpoint example found here. I’ve modified the client to use the parameters from the chunked uploads REST service and when I attempted to do the INIT call, it now returns 404 Not Found.

Here is the code to my custom API Service:

public class TwitterVideoAPI extends TwitterApiClient {

public TwitterVideoAPI(TwitterSession session) {

public TwitterVideoAPIServiceInit initUploadVideo() {
    return getService(TwitterVideoAPIServiceInit.class);

public TwitterVideoAPIServiceAppend appendUploadVideo() {
    return getService(TwitterVideoAPIServiceAppend.class);

public TwitterVideoAPIServiceFinalize finalizeUploadVideo() {
    return getService(TwitterVideoAPIServiceFinalize.class);

public interface TwitterVideoAPIServiceInit {

    void initialize(@Field("command") String command,
                    @Field("total_bytes") String totalBytes,
                    @Field("media_type") String mediaType,
                    Callback <Twitter> callback);

public interface TwitterVideoAPIServiceAppend {
    void append(@Part("command") String command,
                @Part("media_id") String mediaId,
                @Part("media") TypedFile media, // The raw binary file content being uploaded. Cannot be used with media_data.
                // Required after an INIT, an index number starting at zero indicating the order of the uploaded chunks.
                // The chunk of the upload for a single media, from 0-999, inclusive.
                // The first segment_index is 0, the second segment uploaded is 1, etc.
                @Part("segment_index") int segmentIndex,
                Callback <Twitter>  callback);

public interface TwitterVideoAPIServiceFinalize {
    void finalize(@Field("command") String command,
                  @Field("media_id") String mediaId,
                  Callback <Twitter> callback);


Here is how I’m calling the custom service for INIT:

  TwitterVideoAPI videoUpload = new TwitterVideoAPI(session);
  TwitterVideoAPI.TwitterVideoAPIServiceInit init = videoUpload.initUploadVideo();
  init.initialize("INIT", String.valueOf(video.length()), "video%2Fmp4", new Callback<Twitter>() {
  public void success(Result result) {
    Log.e("INIT_SUCCESS", result.toString());

  public void failure(TwitterException e) {
     Log.e("INIT_FAILURE", e.toString() + " - " + e.getMessage());

Any help or pointers on how to get this working properly would be greatly appreciated, as I am having a hard time with this API call.

Fabric android sdk upload video to twitter failure

I think you’re probably hitting instead of to get that 404. I’m not sure how you can manipulate TwitterApiClient to hit a different URL though.


I had a feeling that was the issue. Any ideas on how I can override that base URL?


Using retrofit and a few calls from the Twitter API kit, I was able to sign and POST INIT, and APPEND my video segments.

Unfortunately I now have a different problem in the FINALIZE POST that returns HTTP 500 code 131. Please see my new post for more information:

closed #5