client.Media (MediaClient).
Methods
AddPostToAmplifyProgramsAsync
POST /2/media/amplify/posts
Add Post to Amplify Programs
Publishes one of the authenticated user’s video posts into one or more active Amplify pre-roll programs the user is enrolled in as a publisher.
Parameters
Returns:Task<AddPostToAmplifyProgramsResponse>
AddToLibraryAsync
POST /2/media/library
Add Media to Library
Adds previously uploaded media to the authenticated user’s Media Library with its library metadata. The user must own the media. Geo restrictions, content expiry, the preview image and the audience policy are set with the Media metadata endpoint.
Parameters
Returns:Task<AddMediaToLibraryResponse>
AppendUploadAsync
POST /2/media/upload/{id}/append
Append Media Upload
Appends one segment of the file to a chunked upload. Send the segment base64-encoded in media (raw bytes in multipart bodies) and its position in the file in segment_index, counting from 0. A segment can be up to 8 MB; in a JSON body keep it to 4 MB or less, because base64 adds a third. After the last segment, call Finalize Media Upload.
Parameters
Returns:Task<AppendMediaUploadResponse>
CreateMetadataAsync
POST /2/media/metadata
Create Media Metadata
Creates metadata for a Media file.
Parameters
Returns:Task<CreateMediaMetadataResponse>
CreateSubtitlesAsync
POST /2/media/subtitles
Create Media Subtitles
Creates subtitles for a specific Media file.
Parameters
Returns:Task<CreateMediaSubtitlesResponse>
DeleteSubtitlesAsync
DELETE /2/media/subtitles
Delete Media Subtitles
Deletes subtitles for a specific Media file.
Parameters
Returns:Task<DeleteMediaSubtitlesResponse>
FinalizeUploadAsync
POST /2/media/upload/{id}/finalize
Finalize Media Upload
Completes a chunked upload once every segment is appended. For video the result carries processing_info: the media can go on a Post only when its state is succeeded, so call Get Media Upload Status until it is. A result without processing_info is ready to use.
Parameters
Returns:Task<FinalizeMediaUploadResponse>
GetAmplifyProgramAsync
GET /2/media/amplify/programs/{program_id}
Get Amplify Program
Returns one Amplify pre-roll program the authenticated user is enrolled in as a publisher. A program the user is not enrolled in is reported as not found.
Parameters
Returns:Task<GetAmplifyProgramResponse>
GetAmplifyProgramPostsAsync
GET /2/media/amplify/programs/{program_id}/posts
Get Amplify Program Posts
Returns the posts published into an Amplify pre-roll program the authenticated user is enrolled in as a publisher.
Parameters
Returns:Task<GetAmplifyProgramPostsResponse>
GetAmplifyProgramsAsync
GET /2/media/amplify/programs
Get Amplify Programs
Returns the Amplify pre-roll programs the authenticated user is enrolled in as a publisher.
Task<GetAmplifyProgramsResponse>
GetAnalyticsAsync
GET /2/media/analytics
Get Media Analytics
Retrieves analytics data for media.
Parameters
Returns:Task<GetMediaAnalyticsResponse>
GetByKeyAsync
GET /2/media/{media_key}
Get Media by Media Key
Retrieves details of a specific Media file by its media key.
Parameters
Returns:Task<GetMediaByMediaKeyResponse>
GetByKeysAsync
GET /2/media
Get Media by Media Keys
Retrieves details of Media files by their media keys.
Parameters
Returns:Task<GetMediaByMediaKeysResponse>
GetLibraryCategoriesAsync
GET /2/media/library/categories
Get Media Library Categories
Returns the video categories a publisher can assign to a media library item and the advertiser categories whose ads can be blocked from running against it.
Parameters
Returns:Task<GetMediaLibraryCategoriesResponse>
GetUploadStatusAsync
GET /2/media/upload
Get Media Upload Status
Returns how far X has processed an uploaded media file, in processing_info.state: pending, in_progress, succeeded or failed. Call it after Finalize Media Upload returns processing_info, waiting check_after_secs between calls, until the state is succeeded. A failed state means the media can’t be used.
Parameters
Returns:Task<GetMediaUploadStatusResponse>
InitializeUploadAsync
POST /2/media/upload/initialize
Initialize Media Upload
Starts a chunked media upload and returns its id. Use it for video and for other files too large for one request. For a video on a Post, set media_category to tweet_video, media_type to the file’s type (for example video/mp4) and total_bytes to the file’s size. Send the file with Append Media Upload, call Finalize Media Upload, then pass the id in media.media_ids on Create or Edit Post.
Parameters
Returns:Task<InitializeMediaUploadResponse>
RemoveFromLibraryAsync
DELETE /2/media/library/{media_key}
Remove Media Library Item
Removes an item from the authenticated user’s Media Library. Posts scheduled through the API that have not yet been published and still use the media are cancelled. Published posts and the underlying media are not affected.
Parameters
Returns:Task<RemoveMediaFromLibraryResponse>
UpdateInLibraryAsync
PUT /2/media/library/{media_key}
Update Media Library Item
Updates the library metadata of an item in the authenticated user’s Media Library. Only the fields sent are changed; the others keep their values. Geo restrictions, content expiry, the preview image and the audience policy are set with the Media metadata endpoint.
Parameters
Returns:Task<UpdateMediaInLibraryResponse>
UploadAsync
POST /2/media/upload
Upload Media
Uploads a media file in one request and returns its id. Send the file base64-encoded in media (raw bytes in multipart bodies). For a Post, set media_category to tweet_image (JPG, PNG, GIF or WEBP, up to 5 MB) or tweet_gif, then pass the returned id in media.media_ids on Create or Edit Post. DM media uses dm_image or dm_gif. For video, use Initialize Media Upload.
Parameters
Returns:Task<MediaUploadResponse>