PeopleAggregator API: method metaWeblog.newPost

Arguments | Return value | REST (XML) example | REST (JSON) example | XML-RPC example

Method: metaWeblog.newPost

(metaWeblog API) Creates a new content item. [NOTE: DO NOT USE THE REST FORM OF THIS API CALL; THE METAWEBLOG API IS XML-RPC ONLY]

Arguments (see also Authentication)

If calling by XML-RPC, note that this method takes 5 arguments, NOT a single struct, like most other methods in this API.

blogid

Type: string
Identifier for the 'blog' container you wish to publish to (blogids can be obtained by calling blogger.getUsersBlogs() and looking for the 'blogid' parameter in the array items in the returned data).
Example: user:123

login

Type: string
User's login name.
Example: testme

password

Type: string
User's password.
Example: testuser123

post

Type: hash

Attributes:

title

Type: string
Post title.
Example: Test post
Default:

link

Type: string
Something the post links to.
Example: http://example.org/a_link.html
Default:

description

Type: string
Post content.
Example:

This is a test post.

publish

Type: boolean
true if the post should be published immediately, or false if it should be kept as a draft.
Example: True

Return value (see also Exceptions)

Type: string
The post ID of the created post (suitable for sending back to metaWeblog.editPost and metaWeblog.getPost).
Example: user:123:456

Example REST (XML) request

Request

POST /api/xml/metaWeblog/newPost HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 236

post=%7B%27link%27%3A+%27http%3A%2F%2Fexample.org%2Fa_link.html%27%2C+%27description%27%3A+%27%3Cp%3EThis+is+a+test+post.%3C%2Fp%3E%27%2C+%27title%27%3A+%27Test+post%27%7D&password=testuser123&login=testme&publish=True&blogid=user%3A123

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 50

<response>user:123:456</response>

Example REST (JSON) request

Request

POST /api/json/metaWeblog/newPost HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 236

post=%7B%27link%27%3A+%27http%3A%2F%2Fexample.org%2Fa_link.html%27%2C+%27description%27%3A+%27%3Cp%3EThis+is+a+test+post.%3C%2Fp%3E%27%2C+%27title%27%3A+%27Test+post%27%7D&password=testuser123&login=testme&publish=True&blogid=user%3A123

Response

HTTP/1.1 200 OK
Content-Type: application/x-javascript
Content-Length: 14

"user:123:456"

Example XML-RPC call

Request

POST /api/xmlrpc HTTP/1.1
Content-Type: text/xml
Content-Length: 1979

<?xml version='1.0'?>
 <methodCall>
  <methodName>metaWeblog.newPost</methodName>
  <params>
   <param>
    <value><string>user:123</string></value>
   </param>
   <param>
    <value><string>testme</string></value>
   </param>
   <param>
    <value><string>testuser123</string></value>
   </param>
   <param>
    <value><struct>
     <member>
      <name>link</name>
      <value><string>http://example.org/a_link.html</string></value>
     </member>
     <member>
      <name>description</name>
      <value><string>&lt;p&gt;This is a test post.&lt;/p&gt;</string></value>
     </member>
     <member>
      <name>title</name>
      <value><string>Test post</string></value>
     </member>
    </struct></value>
   </param>
   <param>
    <value><boolean>1</boolean></value>
   </param>
  </params>
 </methodCall>
 

Response

HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 338

<?xml version='1.0'?>
 <methodResponse>
  <params>
   <param>
    <value><string>user:123:456</string></value>
   </param>
  </params>
 </methodResponse>