Yes, it is possible if the version of Wordpress is 3.5 or higher, when using the code to upload a file / image you can set post_id. The thread that I used for new posts with highlighted images looks like this:
use the newPost function and publish the content without image, and also set the publication to false, write down the post_id returned by this
Upload an image and set post_id to the message id just sent, write down image_id
when you finish editing the message and set the wp_post_thumbnail value to the image_id that you just downloaded, and also set the publication to true (if necessary)
Important: The mime type is important, it must be "image / jpg" or "image / png", please see the documentation if the mime worng type, for example, "jpg", will fail.
Hint: For debugging, if you get a general error from Wordpress and you cannot understand why you can check the Wordpress code and even edit it by adding debug / trace calls and I hope you can find out the reason.
This is an example post with a category, image, and tags. This requires the IXR.php class https://github.com/WordPress/WordPress/blob/master/wp-includes/class-IXR.php
and mime_content_type function
https://github.com/caiofior/storebaby/blob/master/magmi/plugins/extra/general/socialnotify/wp/mimetype.php
$client = new IXR_Client($url); $content = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_title' => 'Title', 'post_content' => 'Message', // categories ids 'terms' => array('category' => array(3)) ); $params = array(0, $username, $password, $content); $client->query('wp.newPost', $params); $post_id = $client->getResponse(); $content = array( 'name' => basename('/var/www/sb/img.jpeg'), 'type' => mime_content_type('/var/www/sb/img.jpeg'), 'bits' => new IXR_Base64(file_get_contents('/var/www/sb/img.jpeg')), true ); $client->query('metaWeblog.newMediaObject', 1, $username, $password, $content); $media = $client->getResponse(); $content = array( 'post_status' => 'publish', // Tags 'mt_keywords' => 'tag1, tag2, tag3', 'wp_post_thumbnail' => $media['id'] ); $client->query('metaWeblog.editPost', $post_id, $username, $password, $content, true);