Defining Blog Capabilities with the Options Element
The <options> element within the manifest enables providers to explicitly specify the capabilities of their service so that Writer can make available all of the correct features in its UI. Providers can specify a base client-type (e.g. “MovableType”) and then add or remove features from those implied by this type.
Note that overrides contained within the <options> element can either enable or disable a capability. Therefore, both of the following scenarios are possible:
-
A blog that supports the Metaweblog API plus one or two capabilities of an advanced API can add these capabilities selectively.
-
A blog that supports the MovableType API fully save for one or two capabilities can disable these capabilities selectively.
In order to determine the capabilities of a given service Writer performs two steps:
-
Determine the capabilities implied by the API type (Metaweblog, MovableType, or WordPress). The API type is initially read from the RSD file during blog configuration, but can be overridden later in the manifest by supplying a
<clientType>element within the manifest’s<options>section.
-
Apply overrides contained within the
<options>element of the service’s Writer manifest.
Valid subelements for the <options> element include:
|
|
Optional (no need to provide this if the value provided in the blog’s RSD file is accurate). Base client type for the purpose of calculating blog capabilities. Valid values include: • Metaweblog • MovableType • WordPress |
|
Capabilities Elements |
Zero or more capabilities elements (valid elements enumerated below). |
An example options element might look like this:
<options>
<clientType>Metaweblog</clientType>
<supportsNewCategories>Yes</supportsNewCategories>
<supportsTrackbacks>Yes</supportsTrackbacks>
<supportsEmbeds>Yes</supportsEmbeds>
</options>
The following table enumerates all of the available API capabilities along with the default values for the three supported APIs.
| API Capability | Metaweblog | MovableType | WordPress |
|---|---|---|---|
|
supportsPostAsDraft |
● |
● |
● |
|
supportsFileUpload |
● |
● |
● |
|
supportsExtendedEntries |
|
● |
● |
|
supportsCustomDate |
● |
● |
● |
|
supportsCategories |
● |
● |
● |
|
supportsCategoriesInline |
● |
|
● |
|
supportsMultipleCategories |
● |
● |
● |
|
supportsHierarchicalCategories |
|
|
● |
|
supportsNewCategories |
|
|
● |
|
supportsNewCategoriesInline |
|
|
● |
|
supportsKeywords |
|
● |
|
|
supportsCommentPolicy |
|
● |
● |
|
supportsPingPolicy |
|
● |
● |
|
supportsAuthor |
|
|
● |
|
supportsSlug |
|
|
● |
|
supportsPassword |
|
|
● |
|
supportsExcerpt |
|
● |
● |
|
supportsTrackbacks |
|
● |
● |
|
supportsPages |
|
|
● |
|
supportsPageParent |
|
|
● |
|
supportsPageOrder |
|
|
● |
There are a number of other Writer features which rely on knowledge of service capabilities that aren’t related to blog APIs (e.g. does the blog allows embeds?). These values can also be overridden using the <options> element. The defaults for these values are as follows:
| Capability | Default Value |
|---|---|
|
supportsEmptyTitles |
Yes |
|
requiresHtmlTitles |
Yes |
|
requiresXHTML |
No |
|
supportsScripts |
Unknown |
|
supportsEmbeds |
Unknown |
|
characterSet |
UTF-8 |
|
maxCategoryNameLength |
(None) |
|
invalidPostIdFaultCodePattern |
(None) |
|
invalidPostIdFaultStringPattern |
(None) |
|
supportsAutoUpdate |
Yes |
Depending upon the values implied or specified for each of the available options, Writer makes assumptions about the expected behavior of the blog provider. The following table summarizes the expected behavior for each of the options.
| API Capability | Expected Provider Behavior |
|---|---|
|
supportsPostAsDraft |
Respects the publish flag on metaWeblog.newPost and metaWeblog.editPost calls |
|
supportsFileUpload |
Supports metaWeblog.newMediaObject |
|
supportsExtendedEntries |
Supports mt_text_more field of post struct |
|
supportsCustomDate |
Supports explicit specification of dateCreated field of post struct |
|
supportsCategories |
Supports categorization of posts using either a category array within the post struct or mt.setPostCategories |
|
supportsCategoriesInline |
Supports categories field of post struct |
|
supportsMultipleCategories |
Allows specification of more than one category per post |
|
supportsHierarchicalCategories |
Supports wp.getCategories and wp.addCategory |
|
supportsNewCategories |
Supports the addition of new categories from the client via either inline specification (see below) or via the wp.addCategory method |
|
supportsNewCategoriesInline |
Previously unused categories included within the categories field are automatically added |
|
supportsKeywords |
Supports mt_keywords field of post struct |
|
supportsCommentPolicy |
Supports mt_allow_comments field of post struct |
|
supportsPingPolicy |
Supports mt_allow_pings field of post struct |
|
supportsAuthor |
Supports wp_author field of post struct |
|
supportsSlug |
Supports either wp_slug or mt_basname field of post struct |
|
supportsPassword |
Supports wp_password field of post struct |
|
supportsExcerpt |
Supports mt_excerpt field of post struct |
|
supportsTrackbacks |
Supports mt_tb_ping_urls field of post struct |
|
supportsPages |
Supports WordPress page editing API: wp.newPage, wp.editPage, wp.getPage, wp.getPages, wp.getPageList, and wp.deletePage |
|
supportsPageParent |
Supports wp_page_parent_id field of page struct |
|
supportsPageOrder |
Supports wp_page_order field of page struct |
|
supportsEmptyTitles |
Allows empty string as a valid value for the title field of the post struct |
|
requiresHtmlTitles |
Title field is interpreted as HTML content rather than plain text |
|
requiresXHTML |
Generate XHTML style markup by default |
|
supportsScripts |
Allows embedded script within post content |
|
supportsEmbeds |
Allows object embeds within post content |
The options element also supports a number of other values which effect Writer’s interaction with the blog service. This table enumerates these options along with their valid values and expected behavior:
| Option | Behavior |
|---|---|
|
characterSet |
Determines the character set that Writer uses for XML-RPC interactions with the blog (the default encoding is UTF-8). Valid values for this field correspond to the “.NET Name” column in the table of Code Page Identifiers found at: http://msdn.microsoft.com/en-us/library/dd317756.aspx |
|
maxCategoryNameLength |
Indicates that Writer should enforce a character limit for the names of new categories. |
|
invalidPostIdFaultCodePattern invalidPostIdFaultStringPattern |
In the case of posts created with Writer that are subsequently deleted online the call to metaWeblog.editPost will fail because of an invalid post id. For this case Writer will automatically retry using metaWeblog.newPost if the fault code and/or fault string returned from editPost match the regular expression patterns provided in these options. |
|
supportsAutoUpdate |
Indicates that Writer should automatically poll for updates to the editing manifest whenever a post is created or opened. |