XML-RPC
View .md
XML-RPC endpoint for MetaWeblog and Micro.blog-compatible blog editors. Every call passes a Micro.blog username or email address and an app token as the password, instead of an Authorization header.
Supported methods
Posts
-
metaWeblog.newPost -
microblog.newPost -
metaWeblog.editPost -
microblog.editPost -
metaWeblog.deletePost -
blogger.deletePost -
microblog.deletePost -
metaWeblog.getPost -
microblog.getPost -
metaWeblog.getRecentPosts -
microblog.getPosts
Categories
-
metaWeblog.getCategories -
microblog.getCategories
Media
-
metaWeblog.newMediaObject -
microblog.newMediaObject
Pages
-
microblog.getPages -
microblog.getPage -
microblog.newPage -
microblog.editPage -
microblog.deletePage
newPost and newPage need create. editPost and editPage need update. deletePost and deletePage need delete. newMediaObject needs media. getCategories accepts any of read, create, update, delete, or media. The other get methods need read.
200 status. Fault codes are 403 for a wrong username or token, a token without the needed scope, or a blog that can’t publish; 404 when the blog, post, or page isn’t found or belongs to someone else; 400 for a malformed request; 413 for a request body over 75 MB; and 500 when posting is disabled for the account, for a single-page site, or for a missing page title. The old Blogger methods blogger.newPost, blogger.editPost, blogger.getPost, and blogger.getRecentPosts return a 500 fault. Methods that aren’t listed here, including getUsersBlogs, are not supported.
0 to use the account’s default blog.
https://micro.blog
/xmlrpc
Accepts one XML-RPC method call per request. Posts are created on the blog with cross-posting turned on, and categories that don’t exist yet are created.
newPost, newMediaObject, and newPage take blog ID, username, password, and a struct. editPost and editPage take post or page ID, username, password, and a struct. getPost, getPage, microblog.deletePost, and microblog.deletePage take ID, username, and password. metaWeblog.deletePost and blogger.deletePost take an app key (ignored), post ID, username, and password. getCategories takes blog ID, username, and password. metaWeblog.getRecentPosts takes blog ID, username, password, and a count (default 20). microblog.getPosts and microblog.getPages add an offset after the count.
title, description (the post text, Markdown allowed), mt_excerpt, categories (an array of names), post_status (draft, or anything else to publish), and dateCreated or date_created. editPost replaces the whole post: leaving out title, description, mt_excerpt, or categories clears them, and leaving out post_status publishes a draft. The page struct accepts title (required), description, date_created, and is_navigation (whether the page shows in the blog’s navigation, true by default for new pages).
Example Request
curl -X POST "https://micro.blog/xmlrpc" \
--header "Content-Type: text/xml" \
--data-binary @request.xml
Examples
Create a published post
Call metaWeblog.newPost with a site ID, username, app token, and content struct. Use 0 for the site ID to post to the user’s default site.
curl -X POST "https://micro.blog/xmlrpc" \
--header "Content-Type: text/xml" \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>metaWeblog.newPost</methodName>
<params>
<param><value><string>0</string></value></param>
<param><value><string>USERNAME</string></value></param>
<param><value><string>APP_TOKEN</string></value></param>
<param>
<value>
<struct>
<member>
<name>title</name>
<value><string>Hello from XML-RPC</string></value>
</member>
<member>
<name>description</name>
<value><string>This post was published with the MetaWeblog API.</string></value>
</member>
<member>
<name>categories</name>
<value>
<array>
<data>
<value><string>API</string></value>
</data>
</array>
</value>
</member>
<member>
<name>post_status</name>
<value><string>publish</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
XML
Create a draft post
Set post_status to draft. Other values are treated as published posts.
curl -X POST "https://micro.blog/xmlrpc" \
--header "Content-Type: text/xml" \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>microblog.newPost</methodName>
<params>
<param><value><string>0</string></value></param>
<param><value><string>USERNAME</string></value></param>
<param><value><string>APP_TOKEN</string></value></param>
<param>
<value>
<struct>
<member>
<name>description</name>
<value><string>Draft text for later.</string></value>
</member>
<member>
<name>post_status</name>
<value><string>draft</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
XML
Schedule a post
Include dateCreated or date_created in the content struct to set the post date. A future date schedules the post to publish then.
curl -X POST "https://micro.blog/xmlrpc" \
--header "Content-Type: text/xml" \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>metaWeblog.newPost</methodName>
<params>
<param><value><string>0</string></value></param>
<param><value><string>USERNAME</string></value></param>
<param><value><string>APP_TOKEN</string></value></param>
<param>
<value>
<struct>
<member>
<name>description</name>
<value><string>This post will publish in the future.</string></value>
</member>
<member>
<name>dateCreated</name>
<value><dateTime.iso8601>20260501T09:00:00</dateTime.iso8601></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
XML
Edit an existing post
Call metaWeblog.editPost or microblog.editPost with the post ID, username, app token, and replacement content. Send every field you want to keep, including categories and post_status, because the struct replaces the whole post.
curl -X POST "https://micro.blog/xmlrpc" \
--header "Content-Type: text/xml" \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>metaWeblog.editPost</methodName>
<params>
<param><value><int>12345</int></value></param>
<param><value><string>USERNAME</string></value></param>
<param><value><string>APP_TOKEN</string></value></param>
<param>
<value>
<struct>
<member>
<name>title</name>
<value><string>Updated title</string></value>
</member>
<member>
<name>description</name>
<value><string>Updated post text.</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
XML
Delete a post
Use microblog.deletePost with the post ID, username, and app token. metaWeblog.deletePost takes an extra app key before the post ID.
curl -X POST "https://micro.blog/xmlrpc" \
--header "Content-Type: text/xml" \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>microblog.deletePost</methodName>
<params>
<param><value><int>12345</int></value></param>
<param><value><string>USERNAME</string></value></param>
<param><value><string>APP_TOKEN</string></value></param>
</params>
</methodCall>
XML
Upload media for a post
Upload bytes with metaWeblog.newMediaObject or microblog.newMediaObject. The response struct has url, the uploaded file to insert into a later post, along with type echoed back and placeholder id and file values.
curl -X POST "https://micro.blog/xmlrpc" \
--header "Content-Type: text/xml" \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>metaWeblog.newMediaObject</methodName>
<params>
<param><value><string>0</string></value></param>
<param><value><string>USERNAME</string></value></param>
<param><value><string>APP_TOKEN</string></value></param>
<param>
<value>
<struct>
<member>
<name>name</name>
<value><string>photo.jpg</string></value>
</member>
<member>
<name>type</name>
<value><string>image/jpeg</string></value>
</member>
<member>
<name>bits</name>
<value><base64>/9j/4AAQSkZJRgABAQAAAQABAAD...</base64></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
XML
Header Parameters
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type
|
string | Optional | Request content type. The body is read as XML whatever this says. |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
xml
|
string | Required |
Raw XML-RPC methodCall document.
Example:
<methodCall>...</methodCall>
|
Response
200 OK application/xml
Returns an XML-RPC methodResponse, or a fault (see the notes above). newPost and newPage return the new ID as an integer. editPost, editPage, and the delete methods return true. newMediaObject returns a struct whose url is the uploaded file. metaWeblog.getPost and metaWeblog.getRecentPosts return structs with postid, userid, dateCreated, date_modified, permaLink, title, description, mt_excerpt, categories, and post_status. microblog.getPost and microblog.getPosts use id, author (username and name), date_created, and permalink instead. microblog.getPage and microblog.getPages return id, author, date_created, date_modified, permalink, title, description, is_navigation, is_template, and is_redirect. Dates end in Z.
Example Response
<?xml version="1.0" ?>
<methodResponse>
<params>
<param>
<value><i4>12345</i4></value>
</param>
</params>
</methodResponse>