Video object

The Video object contains info about a user's videos on Microsoft OneDrive.

The Live SDK REST API supports creating, reading, updating, and deleting Video objects.

Use the wl.photos scope to read Video objects. Use the wl.contacts_photos scope to read albums, photos, and videos that other users have shared with the user. Use the wl.skydrive_update scope to create, update, or delete Video objects.

Valid object paths

  • /VIDEO_ID

A Video object can be returned as part of /ALBUM_ID/files, /ALBUM_ID/videos, /FOLDER_ID/files, /me/skydrive/files, /me/skydrive/shared/videos, or USER_ID/skydrive/files.

Structures

The Video object contains the following structures.

Structure

Type

R/W

Description

data

array

R

An array of Video objects, if a collection of objects is returned.

id

string

R

The Video object's ID.

from

object

R

Info about the user who uploaded the video.

name (from object)

string

R

The name of the user who uploaded the video.

id (from object)

string

R

The ID of the user who uploaded the video.

name

string

RW

The file name of the video. Required.

description

string/null

RW

A description of the video, or null if no description is specified.

parent_id

string

R

The id of the folder where the item is stored.

size

number

R

The size, in bytes, of the video.

comments_count

number

R

The number of comments that are associated with the video.

comments_enabled

true/false

R

A value that indicates whether comments are enabled for the video. If comments can be made, this value is true; otherwise, it is false.

tags_count

number

R

The number of tags on the video.

tags_enabled

true/false

R

A value that indicates whether tags are enabled for the video. If tags can be set, this value is true; otherwise, it is false.

is_embeddable

true/false

R

A value that indicates whether this video can be embedded. If this video can be embedded, this value is true; otherwise, it is false.

picture

string

R

A URL of a picture that represents the video.

source

string

R

The download URL for the video. Important: This value is not persistent. Use it immediately after making the request, and avoid caching.

upload_location

string

R

The URL to upload video content, hosted in OneDrive. This value is returned only if the wl.skydrive scope is present.

link

string

R

A URL of the video, hosted in OneDrive.

height

number

R

The height, in pixels, of the video.

width

number

R

The width, in pixels, of the video.

duration

number

R

The duration, in milliseconds, of the video run time.

bitrate

number

R

The bit rate, in bits per second, of the video.

type

string

R

The type of object; in this case, "video".

shared_with

object

R

The object that contains permission info.

access (shared_with object)

string

R

Info about who can access the file. The options are: People I selected, Just me, Everyone (public), Friends, My friends and their friends, and People with a link. The default is Just me.

created_time

string

R

The time, in ISO 8601 format, at which the video was created.

updated_time

string

R

The time, in ISO 8601 format, at which the video was last updated.

Examples

The following is an example of a collection of Video objects. (For brevity, only the first object is shown.)

{
    "data": [
      {
         "id": "file.de57f4126ed7e411.DE57F4126ED7E411!135", 
         "from": {
            "name": "Nuno Bento", 
            "id": "de57f4126ed7e411"
         }, 
         "name": "Wildlife.wmv", 
         "description": null, 
         "parent_id": "folder.de57f4126ed7e411.DE57F4126ED7E411!126", 
         "size": 26246026, 
         "comments_count": 0, 
         "comments_enabled": true, 
         "tags_count": 0, 
         "tags_enabled": true, 
         "is_embeddable": true,
         "picture": "http://storage.live.com/s1pKk5vzd-gdPaJ5Q1MKN34itsyRlUkAYzD_zsr0Dg-5r4bH8Qo8XRgsunA0M-V4G-XPpu1spowx4xwfjCuDcWQVa7aWld2WCdfeWjBK_coPqaQqzoE26BJP3OZAITB5i_DRPK8jK3ZLilSbNJd-onrOA/Wildlife.wmv:Thumbnail", 
         "source": "http://storage.live.com/s1pKk5vzd-gdPaJ5Q1MKN34itsyRlUkAYzD_zsr0Dg-5r4bH8Qo8XRgsunA0M-V4G-XPpu1spowx4xwfjCuDcWQVa7aWld2WCdfeWjBK_coPqaQqzoE26BJP3OZAITB5i_DRPK8jK3ZLilSbNJd-onrOA/Wildlife.wmv:VideoMain", 
         "upload_location": "https://apis.live.net/v5.0/file.de57f4126ed7e411.DE57F4126ED7E411!135/content/", 
         "link": "https://skydrive.live.com/redir.aspx?cid\u003dde57f4126ed7e411\u0026page\u003dview\u0026resid\u003dDE57F4126ED7E411!135\u0026parid\u003dDE57F4126ED7E411!126", 
         "height": 720, 
         "width": 1280, 
         "duration": 30093, 
         "bitrate": 5942130, 
         "type": "video", 
         "shared_with": {
            "access": "Everyone (public)"
         }, 
         "created_time": "2011-08-23T23:41:18+0000", 
         "updated_time": "2011-08-23T23:41:32+0000"
      }, {
         ...
      } 
   ]
}

To get a collection of Video objects by using the Live Connect REST API, make a GET request to /ALBUM_ID/files.

Note

You can also get a collection of Video objects by calling either /ALBUM_ID/videos, or /FOLDER_ID/videos.

In the preceding examples, replace ALBUM_ID with the target album ID.

To create a new Video resource, you can make either a PUT request with the video in the body or a POST request with the video in a multipart form body. For POST, make a POST request to the /UPLOAD_LOCATION for the target folder or a POST request to /FOLDER_ID. You must format the request as a multipart/form-data media type as described in RFC 2388. You must specify the Content-Type as multipart/form-data and specify the boundary, as shown here.

Content-Type: multipart/form-data; boundary=AaB03x

Provide the item to upload on a multipart section, and the name of the photo as the value of the filename parameter of the Content-Disposition header, as shown here.

Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="file"; filename="strange_lights.avi"
Content-Type: video/x-msvideo

...contents of strange_lights.avi...
--AaB03x--

Note

The boundary value (shown here as "AaB03x") can be any arbitrary string value.

Only one multipart section per request is supported. For a PUT request, leave the Content-Type blank and put the contents of the file in the request body.

Upon successful creation, the location header points to the location for the newly created video, and the response body contains the following properties.

{
   "id": "ID of the new video",
   "name": "The file's name and file extension",
   "source": "URL where the video can be downloaded from"
}

You can upload a video to an existing resource in any of the following ways.

  • Make a PUT request to /UPLOAD_LOCATION/FILE_NAME of the parent folder's ID.

  • Make a PUT request to /FOLDER_ID/files/FILE_NAME.

  • Make a PUT request to /ALBUM_ID/files/FILE_NAME.

  • Make a PUT request to /UPLOAD_LOCATION for the file to update.

  • Make a PUT request to /VIDEO_ID/content.

To update the properties for a Video resource, make a PUT request to /VIDEO_ID, and specify the changes in the request body, as shown here.

{
   "name": "triangle_formation.avi"
   "description": "Sightings of UFOs in triangle formation."
}

To delete a video, make a DELETE request to /VIDEO_ID.

To move a video, make a MOVE request to /VIDEO_ID or /FOLDER_ID, and specify the ID of the destination folder in the request body, as shown here.

{
   "destination": "FOLDER_ID"
}

To copy a video, make a COPY request to /VIDEO_ID or /FOLDER_ID, and specify the ID of the destination folder in the request body, as shown here.

{
   "destination": "FOLDER_ID"
}

For PUT and POST requests, you can use the overwrite query string parameter to indicate whether the request should fail if the resource already exists, as shown here. Optionally you can specify an overwrite query-string parameter value of ChooseNewName if you want to upload a duplicate copy of the file but let OneDrive choose the uploaded file's new file name.

overwrite=true
overwrite=false
overwrite=ChooseNewName

If the value of the overwrite query string parameter is set to true, and the file exists, it is overwritten. If the value is set to false, the file is not overwritten and a resource_already_exists error is returned. If no overwrite query string parameter is specified, the default value is true.

See also

REST objects