PeopleAggregator API: method metaWeblog.getRecentPosts

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

Method: metaWeblog.getRecentPosts

(metaWeblog API) Get a number of recent posts from a blog. [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 4 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

n_posts

Type: int
The number of posts to retrieve
Example: 10
Maximum: 50

Return value (see also Exceptions)

Type: array

Content of each item:

item

Type: hash

Attributes:

dateCreated

Type: datetime
The post's timestamp
Example: 2006-05-20T12:34:56Z

userid

Type: string
The user ID for the user who created this post
Example: marc

postid

Type: string
The ID of this post
Example: user:123:456

title

Type: string
Post title
Example: This is a post

description

Type: string
Post content
Example: It really is.

link

Type: string
Link associated with this post
Example: marc

permaLink

Type: string
Permalink of this post
Example: http://example.org/content.php?cid=456

categories

Type: array
List of categories attached to this post

Content of each item:

item

Type: string
Name of a category (ID of a category?)
Example: Uncategorized

Example REST (XML) request

Request

Response

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

<response>
 <item>
  <permaLink>http://example.org/content.php?cid=456</permaLink>
  <description>It really is.</description>
  <title>This is a post</title>
  <userid>marc</userid>
  <dateCreated>2006-05-20T12:34:56Z</dateCreated>
  <link>marc</link>
  <postid>user:123:456</postid>
  <categories>
   <item>Uncategorized</item>
  </categories>
 </item>
</response>

Example REST (JSON) request

Request

Response

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

[{"permaLink": "http://example.org/content.php?cid=456", "description": "It really is.", "title": "This is a post", "userid": "marc", "dateCreated": "2006-05-20T12:34:56Z", "link": "marc", "postid": "user:123:456", "categories": ["Uncategorized"]}]

Example XML-RPC call

Request

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

<?xml version='1.0'?>
 <methodCall>
  <methodName>metaWeblog.getRecentPosts</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><int>10</int></value>
   </param>
  </params>
 </methodCall>
 

Response

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

<?xml version='1.0'?>
 <methodResponse>
  <params>
   <param>
    <value><array><data>
     <value><struct>
      <member>
       <name>permaLink</name>
       <value><string>http://example.org/content.php?cid=456</string></value>
      </member>
      <member>
       <name>description</name>
       <value><string>It really is.</string></value>
      </member>
      <member>
       <name>title</name>
       <value><string>This is a post</string></value>
      </member>
      <member>
       <name>userid</name>
       <value><string>marc</string></value>
      </member>
      <member>
       <name>dateCreated</name>
       <value><string>2006-05-20T12:34:56Z</string></value>
      </member>
      <member>
       <name>link</name>
       <value><string>marc</string></value>
      </member>
      <member>
       <name>postid</name>
       <value><string>user:123:456</string></value>
      </member>
      <member>
       <name>categories</name>
       <value><array><data>
        <value><string>Uncategorized</string></value>
       </data></array></value>
      </member>
     </struct></value>
    </data></array></value>
   </param>
  </params>
 </methodResponse>