[The Events Calendar] Specifying feature image in event via REST API

[ad_1]

Hello,

I’m trying to add events with featured images via the v1 REST API but I am getting an error. I have the media uploaded to my wordpress site already, so I’m trying to link to that media. I couldn’t find any documentation on this process, so I used a GET request on an existing post to figure out the structure, and came up with this:

{
  "id": 224,
  "image": {
    "url": "https://wp.example.org/wp/content/uploads/2023/11/image.jpg",
    "extension": "jpg"
    }
}

However, any time I use the “image” structure in my POST body I get a 400 error back saying that “image” is an invalid parameter. I have tried many combinations of settings underneath “image”, but I always get the same error, so it appears to not like that container.

{
  "code": "rest_invalid_param",
  "message": "Invalid parameter(s): image",
  "data": {
    "status": 400,
    "params": {
      "image": "Invalid parameter."
    },
    "details": []
  }
}

Is it possible to set images using the REST API? Could somebody point me in the right direction?

  • This topic was modified 16 minutes ago by ibarrere.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer