Media

The Media service is used for managing Umbraco Media. All requests to the Media service must be authenticated with a user account with permissions to modify the Umbraco Media section.

GET /rest/media?mediatypealias={mediatypealias}

Get's the root list of media items, filtered by the optional Media Type Alias.

Response
Returns a '200 OK' status code.

Content Type: application/json

[
    {
        "Id" : 1234,
        "Name" : "Media Name",
        "MediaTypeAlias" : "Media Type Alias",
        ...
    },
    {
        "Id" : 1235,
        "Name" : "Media Name",
        "MediaTypeAlias" : "Media Type Alias",
        ...
    }
]

GET /rest/media/{id}

Gets a single media item identified by its integer ID.

Response
Returns a '200 OK' status code.

Content Type: application/json

{
    "Id" : 1234,
    "Name" : "Media Name",
    "MediaTypeAlias" : "Media Type Alias",
    ...
}

GET /rest/media/{id}/media?mediatypealias={mediatypealias}

Gets a list of child media items for the media item identified by its integer ID, filtered by the optional Media Type Alias.

Response
Returns a '200 OK' status code.

Content Type: application/json

[
    {
        "Id" : 1234,
        "Name" : "Media Name",
        "MediaTypeAlias" : "Media Type Alias",
        ...
    },
    {
        "Id" : 1235,
        "Name" : "Media Name",
        "MediaTypeAlias" : "Media Type Alias",
        ...
    }
]

POST /rest/media

Creates a new media item.

Request
Requests should be sent as content type multipart/form-data

Content Type: application/json
Name: resource

{
    "Name" : "Media Name",
    "MediaTypeAlias" : "Media Type Alias",
    ...
}

Content Type: application/octet-stream
Name: file

[File Data]
Response
Returns a '201 Created' status code.

Content Type: application/json

{
    "Id" : 1234,
    "Name" : "Media Name",
    "MediaTypeAlias" : "Media Type Alias",
    ...
}

POST /rest/media/{id}/media

Creates a new child media item for the media item identified by its integer ID.

Request
Requests should be sent as content type multipart/form-data

Content Type: application/json
Name: resource

{
    "Name" : "Media Name",
    "MediaTypeAlias" : "Media Type Alias",
    ...
}

Content Type: application/octet-stream
Name: file

[File Data]
Response
Returns a '201 Created' status code.

Content Type: application/json

{
    "Id" : 1234,
    "Name" : "Media Name",
    "MediaTypeAlias" : "Media Type Alias",
    ...
}

PUT /rest/media/{id}

Updates an existing media item identified by its integer ID.

Request
Requests should be sent as content type multipart/form-data

Content Type: application/json
Name: resource

{
    "Name" : "Media Name",
    "MediaTypeAlias" : "Media Type Alias",
    ...
}

Content Type: application/octet-stream
Name: file

[File Data]
Response
Returns a '201 Created' status code.

Content Type: application/json

{
    "Id" : 1234,
    "Name" : "Media Name",
    "MediaTypeAlias" : "Media Type Alias",
    ...
}

DELETE /rest/media/{id}

Deletes a media item identified by its integer ID.

Response
Returns a '204 No Content' status code.

Resources

Media

{
    "Id" : 1234,
    "Href" : "http://www.yoursite.com/rest/media/1234",
    "ParentId" : 1233,
    "ParentHref" : "http://www.yoursite.com/rest/media/1233",
    "Name" : "Media Name",
    "MediaTypeAlias" : "Media Type Alias",
    "Properties" : [
        {
            "Key" : "Property Key",
            "Value" : "Property Value"   
        },
        ...
    ],
    "HasChildren" : true,
    "ChildrenHref" : "http://www.yoursite.com/rest/media/1234/media"
}

Last edited Dec 20, 2010 at 8:16 AM by mattbrailsford, version 10

Comments

No comments yet.