Attaching feature image to post created - using API

So, I’m creating posts using the admin API and it works great.

Can’t figure out how to upload and attach an image as feature image.

Is it a two-step process? First (1) upload over API and then (2) create post using the
"feature_image": "[url]" from step 1? Or how does this work?

Any assistance highly appreciated.

Thank you

1 Like

That’s right. Upload the image first, get the image reference, then create (or update) the post.

1 Like

Could you confirm that this is correct? Im uploading the image, which is successful, then creating a post with this data. The feature image variable holds the link to the uploaded image.

    post_data = {
        "title": title,
        "date": date,
        "content": content,
        # "feature_image": feature_image  # Include the image URL here

Thank you @Cathy_Sarisky