media-assets resource endpoint

URL: /blogs/<id>/media-assets.<format>

This endpoint represents the set of media assets in a blog. At present this endpoint can't actually be used to retrieve the assets, but it is used to create new assets. A media asset represents a file that you can embed in or link from a post or page. The most common use of this endpoint is to upload images that will be used in a post, which will create a Photo asset object.

This endpoint expects a file payload. The easiest way to upload a file via this endpoint is to send a POST request to the endpoint whose body is the content of the file, and set the Content-Type HTTP header to an appropriate MIME type for the file you're uploading. If you're uploading a photo then this will probably be image/jpeg. If you upload a file in this way then TypePad will create a new asset with all of its metadata properties set to the defaults, as if you'd submitted an empty Asset object.

It is also possible to upload files via the /browser-upload endpoint, which is an adaptor that behaves in a way that affords uploading files directly to TypePad from a web form. Just set the target_url argument to /blogs/{id}/media-assets (substituting a suitable blog id) to let it know that you're intending the created asset to belong to a blog. Since media assets have no required metadata properties, you can set the asset argument to an empty JSON object, which is literally {}.





Supported Methods

POST Add a new media asset to the account that owns this blog.

Query String Arguments

start-index
Index of the first item to return. The first item in the list has index 1.
max-results
Maximum number of items to return in the list response.

Resource Type

This endpoint returns an object of type List<Asset>.

entries (array<Asset>)
The items within the selected range.
totalResults (integer)
The total number of items in the whole list of which this object is a chunk.

POST Request Object Type

This endpoint accepts a file as part of its payload. Therefore POST requests to this endpoint should be of type multipart/related and have two parts. The first has type application/json and includes a JSON serialization of the properties described below. The second is the file to attach.

If none of the properties below are required for a particular request, and the file being uploaded is not of type application/json or multipart/*, the file may be submitted directly to this endpoint with an appropriate Content-Type header and no MIME envelope. This is a shorthand for sending a multipart/related message with the JSON part containing the empty object, {}.

The following properties are accepted for the JSON part of a POST request to this endpoint:

author (User)
(Read Only) The user who created the selected asset.
commentCount (integer)
(Read Only) The number of comments that have been posted in reply to this asset. This number includes comments that have been posted in response to other comments.
container (ContainerRef)
(Read Only) An object describing the group or blog to which this asset belongs.
content (string)
The raw asset content. The textFormat property describes how to format this data. Use this property to set the asset content in write operations. An asset posted in a group may have a content value up to 10,000 bytes long, while a Post asset in a blog may have up to 65,000 bytes of content.
crosspostAccounts (set<string>)
(Write Only) A set of identifiers for Account objects to which to crosspost this asset when it's posted. This property is omitted when retrieving existing assets.
description (string)
The description of the asset.
excerpt (string)
(Read Only) A short, plain-text excerpt of the entry content. This is currently available only for Post assets.
favoriteCount (integer)
(Read Only) The number of distinct users who have added this asset as a favorite.
groups (array<string>)
(Read Only) (Deprecated) An array of strings containing the id URI of the Group object that this asset is mapped into, if any. This property has been superseded by the container property.
hasExtendedContent (boolean)
(Read Only) true if this asset has the extended content. This is currently supported only for Post assets that are posted within a blog.
id (string)
(Read Only) A URI that serves as a globally unique identifier for the user.
isFavoriteForCurrentUser (boolean)
(Read Only) true if this asset is a favorite for the currently authenticated user, or false otherwise. This property is omitted from responses to anonymous requests.
negativeVoteCount (integer)
(Read Only) The total number of negative votes this asset has received via the /assets/<id>/cast-negative-vote endpoint.
objectType (string)
(Read Only) The keyword identifying the type of asset this is.
objectTypes (set<string>)
(Read Only) (Deprecated) An array of object type identifier URIs identifying the type of this asset. Only the one object type URI for the particular type of asset this asset is will be present.
permalinkUrl (string)
(Read Only) The URL that is this asset's permalink. This will be omitted if the asset does not have a permalink of its own (for example, if it's embedded in another asset) or if TypePad does not know its permalink.
positiveVoteCount (integer)
(Read Only) The total number of positive votes this asset has received via the /assets/<id>/cast-positive-vote endpoint.
publicationStatus (PublicationStatus)
An object describing the visibility status and publication date for this asset. Only visibility status is editable.
published (datetime)
(Read Only) The time at which the asset was created, as a W3CDTF timestamp.
reblogOf (AssetRef)
(Read Only) (Deprecated) If this asset was created by 'reblogging' another asset, this property describes the original asset.
reblogOfUrl (string)
(Read Only) (Deprecated) If this asset was created by 'reblogging' another asset or some other arbitrary web page, this property contains the URL of the item that was reblogged.
renderedContent (string)
(Read Only) The content of this asset rendered to HTML. This is currently available only for Post and Page assets.
shortUrl (string)
(Read Only) The short version of the URL that is this asset's permalink. This is currently available only for Post assetes.
source (AssetSource)
(Read Only) An object describing the site from which this asset was retrieved, if the asset was obtained from an external source.
textFormat (string)
A keyword that indicates what formatting mode to use for the content of this asset. This can be html for assets the content of which is HTML, html_convert_linebreaks for assets the content of which is HTML but where paragraph tags should be added automatically, or markdown for assets the content of which is Markdown source. Other formatting modes may be added in future. Applications that present assets for editing should use this property to present an appropriate editor.
title (string)
The title of the asset.
urlId (string)
(Read Only) A string containing the canonical identifier that can be used to identify this object in URLs. This can be used to recognise where the same user is returned in response to different requests, and as a mapping key for an application's local data store.

Client Library Methods for PHP

Add a new media asset to the account that owns this blog.
$tp->blogs->postToMediaAssets(array(

    # Required Parameters
    "id" => $id,
    "payload" => $payload,

))