API Import File + Create Draft Post = bug for the cover image

Question:
Why is my cover image width and height are not set when creating a media then a post thanks to the API? Then it leads to the impossibility of showing the image properly.

Product:
API

What are you trying to achieve:
I am uploading an image file thanks to the API, then I am creating a draft post thanks to the api and i am specifying the media (previously upload) id. When i go to the blog post panel, the image is well featured in the settings of the post. But then when I preview my blog post lists, the hero image is bugged, indeed in their URL there is w_NaN and h_NaN
Like this
https://static.wixstatic.com/media/image_id/v1/fill/w_NaN,h_NaN,fp_0.50_0.50,lg_1,q_90,enc_auto/###

but after going back to the blog post panel, in the settings, if I attribute the exact same image in the modal, then no bug.

So what I am missing here with the API call?

Moreover, when creating the post, in the response the width and height of the post are set to 0.

Summary
{
  "draftPost": {
    "id": "###",
    "title": "###",
    "featured": false,
    "categoryIds": [],
    "coverMedia": {
      "enabled": true,
      "image": {
        "id": "###~mv2.jpg",
        "url": "https://static.wixstatic.com/media/###~mv2.jpg",
        "height": 0,
        "width": 0,
        "filename": "###.jpg"
      },
      "displayed": true,
      "custom": false
    },
    "memberId": "###",
    "hashtags": [],
    "commentingEnabled": true,
    "minutesToRead": 5,
    "heroImage": {
      "id": "###~mv2.jpg",
      "url": "https://static.wixstatic.com/media/###~mv2.jpg",
      "height": 0,
      "width": 0,
      "filename": "###.jpg"
    },
    "tagIds": [],
    "relatedPostIds": [],
    "pricingPlanIds": [],
    "language": "en",
    "changeOrigin": "PUBLISH",
    "contentId": "662a028ff14ba036630988ba",
    "editingSessionId": "7ae2f474-01dd-4711-91b3-66483e4f760a",
    "status": "PUBLISHED",
    "mostRecentContributorId": "a7083f9c-f008-425b-8880-6f3f8362b38d",
    "hasUnpublishedChanges": false,
    "editedDate": "2024-04-25T07:34:09.626Z",
    "firstPublishedDate": "2024-04-25T07:00:11.188Z",
    "seoData": {
      "tags": [],
      "settings": {
        "preventAutoRedirect": false,
        "keywords": []
      }
    },
    "slugs": [
      "###"
    ],
    "createdDate": "2024-04-25T07:00:10.752Z",
    "seoSlug": "###",
    "media": {
      "wixMedia": {
        "image": {
          "id": "###~mv2.jpg",
          "url": "https://static.wixstatic.com/media/###~mv2.jpg",
          "height": 0,
          "width": 0,
          "filename": "###.jpg"
        }
      },
      "displayed": true,
      "custom": false
    },
    "translations": []
  }
}

Neverthe less the OG image works well.

I kindly thank you for your help and if you need further information, please let me know.

PS: Here are my data send to the API create draft post (I have removed richContent to avoid having it too long…

Summary
{
  "draftPost": {
    "richContent": {},
    "title": "###",
    "heroImage": {
      "id": "###~mv2.jpg"
    },
    "media": {
      "displayed": true,
      "wixMedia": {
        "image": {
          "id": "###~mv2.jpg"
        }
      }
    }
  },
  "action": "UPDATE_PUBLISH"
}

Can you clarify which API endpoint you’re referring to? Maybe link to the docs?

Hi Anthony, thank you for your response.

API site-media/v1/files/import
Generate File Resumable Upload Url | REST
then
API blog/v3/draft-posts/
https://dev.wix.com/docs/rest/crm/community/blog/draft-posts/create-draft-post

Gotcha. I’m not sure why it’s not working. Perhaps the URL should be a wix:// URL rather than a fully qualified URL. Either way the best place to report this and get help is the App Dev team: Wix Developers Login

Hi, can you share the code you used for your Draft Posts API? The documentation is bad and I keep getting a crazy amount of errors, Thanks!