Set Featured Image in WordPress via XML-RPC

Yes it is possible to do it, if WordPress version is 3.5 or greater,when using the code for uploading file/image you can set the post_id. The flow I used for new posts with featured images is like this:

1 use the newPost function and post the content without the featured image and also set publish to false, record the post_id returned by this

2 upload the image and set the post_id to the id of the post just posted, record the image_id

3 when done edit the post and set the wp_post_thumbnail equal to the image_id you just uploaded and also set publish to true(if needed)

Important: The mime type is important, it must be “image/jpg” or “image/png” please see documentation, if mime type is worng like “jpg” attaching will fail.

Tip: For debugging, if you get a generic error from wordpress and you can’t figure out why you can check the wordpress code and even edit it, adding debugging/tracing calls and hopefully you can figure out the cause.