Skip to content

Latest commit

 

History

History
196 lines (130 loc) · 12 KB

VideoApi.md

File metadata and controls

196 lines (130 loc) · 12 KB

LT\SDKs\ebay\rest\media\VideoApi

All URIs are relative to https://apim.ebay.com/commerce/media/v1_beta.

Method HTTP request Description
createVideo() POST /video
getVideo() GET /video/{video_id}
uploadVideo() POST /video/{video_id}/upload

createVideo()

createVideo($body)

This method creates a video. When using this method, specify the title, size, and classification of the video to be created. Description is an optional field for this method.

<span class="tablenote"><span style="color:#478415">Tip: See <a href="https://www.ebay.com/help/selling/listings/creating-managing-listings/add-video-to-listing?id=5272#section3\" target="_blank">Adding a video to your listing in the eBay Seller Center for details about video formatting requirements and restrictions, or visit the relevant eBay site help pages for the region in which the listings will be posted.

When a video is successfully created, the method returns the HTTP Status Code 201 Created.The method also returns the location response header containing the video ID, which you can use to retrieve the video.

<span class="tablenote"><span style="color:#004680">Note: There is no ability to edit metadata on videos at this time. There is also no method to delete videos.

To upload a created video, use the <a href=" /api-docs/commerce/media/resources/video/methods/uploadVideo" target="_blank">uploadVideo method.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: Authorization Code
$config = LT\SDKs\ebay\rest\media\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new LT\SDKs\ebay\rest\media\Api\VideoApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \LT\SDKs\ebay\rest\media\Model\CreateVideoRequest(); // \LT\SDKs\ebay\rest\media\Model\CreateVideoRequest

try {
    $apiInstance->createVideo($body);
} catch (Exception $e) {
    echo 'Exception when calling VideoApi->createVideo: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
body \LT\SDKs\ebay\rest\media\Model\CreateVideoRequest [optional]

Return type

void (empty response body)

Authorization

[Authorization Code](../../README.md#Authorization Code)

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getVideo()

getVideo($videoId): \LT\SDKs\ebay\rest\media\Model\Video

This method retrieves a video's metadata and content given a specified video ID. The method returns the title, size, classification, description, video ID, playList, status, status message (if any), expiration date, and thumbnail image of the retrieved video.

The video’s title, size, classification, and description are set using the <a href=" /api-docs/commerce/media/resources/video/methods/createVideo" target="_blank">createVideo method.

The video's playList contains two URLs that link to instances of the streaming video based on the supported protocol.

The status field contains the current status of the video. After a video upload is successfully completed, the video's status will show as PROCESSING until the video reaches one of the terminal states of LIVE, BLOCKED or PROCESSING_FAILED.

If a video's processing fails, it could be because the file is corrupted, is too large, or its size doesn’t match what was provided in the metadata. Refer to the error messages to determine the cause of the video’s failure to upload.

The status message will indicate why a video was blocked from uploading.

The video’s expiration date is automatically set to 365 days (one year) after the video’s initial creation.

The video's thumbnail image is automatically generated when the video is created.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: Authorization Code
$config = LT\SDKs\ebay\rest\media\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new LT\SDKs\ebay\rest\media\Api\VideoApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$videoId = 'videoId_example'; // string | The <b>video ID</b> for the video to be retrieved.

try {
    $result = $apiInstance->getVideo($videoId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VideoApi->getVideo: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
videoId string The <b>video ID</b> for the video to be retrieved.

Return type

\LT\SDKs\ebay\rest\media\Model\Video

Authorization

[Authorization Code](../../README.md#Authorization Code)

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

uploadVideo()

uploadVideo($contentType, $videoId, $contentLength, $contentRange, $body)

This method associates the specified file with the specified video ID and uploads the input file. After the file has been uploaded the processing of the file begins.

<span class="tablenote"><span style="color:#004680">Note: The size of the video to be uploaded must exactly match the size of the video's input stream that was set in the <a href=" /api-docs/commerce/media/resources/video/methods/createVideo" target="_blank">createVideo method. If the sizes do not match, the video will not upload successfully.

When a video is successfully uploaded, it returns the HTTP Status Code 200 OK.

The status flow is PENDING_UPLOAD > PROCESSING > LIVE, PROCESSING_FAILED, or BLOCKED. After a video upload is successfully completed, the status will show as PROCESSING until the video reaches one of the terminal states of LIVE, BLOCKED, or PROCESSING_FAILED. If the size information (in bytes) provided is incorrect, the API will throw an error.

<span class="tablenote"><span style="color:#478415">Tip: See <a href="https://www.ebay.com/help/selling/listings/creating-managing-listings/add-video-to-listing?id=5272#section3\" target="_blank">Adding a video to your listing in the eBay Seller Center for details about video formatting requirements and restrictions, or visit the relevant eBay site help pages for the region in which the listings will be posted.

To retrieve an uploaded video, use the <a href="/api-docs/commerce/media/resources/video/methods/getVideo" target="_blank">getVideo method.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: Authorization Code
$config = LT\SDKs\ebay\rest\media\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new LT\SDKs\ebay\rest\media\Api\VideoApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$contentType = 'contentType_example'; // string | Use this header to specify the content type for the upload. The Content-Type should be set to <code>application/octet-stream</code>.
$videoId = 'videoId_example'; // string | The <b>video ID</b> for the uploaded video.
$contentLength = 'contentLength_example'; // string | Use this header to specify the content length for the upload. Use Content-Range: bytes {1}-{2}/{3} and Content-Length:{4} headers.<br /><br /><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note:</strong></span> This header is optional and is only required for <i>resumable</i> uploads (when an upload is interrupted and must be resumed from a certain point).</span>
$contentRange = 'contentRange_example'; // string | Use this header to specify the content range for the upload. The Content-Range should be of the following bytes ((?:[0-9]+-[0-9]+)|\\\\\\\\*)/([0-9]+|\\\\\\\\*) pattern.<br /><br /><span class=\"tablenote\"><span style=\"color:#004680\"><strong>Note:</strong></span> This header is optional and is only required for <i>resumable</i> uploads (when an upload is interrupted and must be resumed from a certain point).</span>
$body = array('key' => new \stdClass); // object | The request payload for this method is the input stream for the video source. The input source must be an .mp4 file of the type MPEG-4 Part 10 or Advanced Video Coding (MPEG-4 AVC).

try {
    $apiInstance->uploadVideo($contentType, $videoId, $contentLength, $contentRange, $body);
} catch (Exception $e) {
    echo 'Exception when calling VideoApi->uploadVideo: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
contentType string Use this header to specify the content type for the upload. The Content-Type should be set to <code>application/octet-stream</code>.
videoId string The <b>video ID</b> for the uploaded video.
contentLength string Use this header to specify the content length for the upload. Use Content-Range: bytes {1}-{2}/{3} and Content-Length:{4} headers.<br /><br /><span class=&quot;tablenote&quot;><span style=&quot;color:#004680&quot;><strong>Note:</strong></span> This header is optional and is only required for <i>resumable</i> uploads (when an upload is interrupted and must be resumed from a certain point).</span> [optional]
contentRange string Use this header to specify the content range for the upload. The Content-Range should be of the following bytes ((?:[0-9]+-[0-9]+) \\\\*)/([0-9]+
body object The request payload for this method is the input stream for the video source. The input source must be an .mp4 file of the type MPEG-4 Part 10 or Advanced Video Coding (MPEG-4 AVC). [optional]

Return type

void (empty response body)

Authorization

[Authorization Code](../../README.md#Authorization Code)

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]