How to get all posts (in chunks) via XML-RPC?

I would like to retrieve all posts of a blog via the XML-RPC API of WordPress.

There are the methods of blogger.getRecentPosts and metaWeblog.getRecentPosts which – given a sufficiently high value as number of posts (or -1) in theory should return all posts.

However, this does not work for very large blogs or very weak servers that cannot hold the whole blog in memory. In that case, these functions will not return anything at best or throw an error into the response XML.

A solution would be to retrieve smaller chunks of, e.g. 50, posts at a time and put it all together on the receiving side. For this to work one would need to specify an offset for the posts to get. I was not able to find a way to specify such an offset in the documented API.

Is there any way to make this work, either by specifying an offset or by using other than the methods mentioned above?

I’m not looking for a description on how to write a plugin or modify WordPress itself in any way. I can do that, sure, but I’m talking about authorized retrieval of data of arbitrary WordPress blogs.

Edit: I’ve opened a trac ticket at WordPress with a suggestion for solution: http://core.trac.wordpress.org/ticket/16316

5 Answers
5

According to topic in official forums [xmlrpc] How to get posts with offset?

The existing XML-RPC APIs don’t really
provide a way for collecting all of
the post data right now. (Joseph
Scott)

Topic is somewhat old and I am not aware if there were some changes since, but from quick look at source it doesn’t seem so.

Leave a Comment