I have a Laravel project, I want to create post in Wix site by rest API. All is going well, only one issue I can’t resolve till now. Image in blog list page is not showing even in blog view page and in related post section it showing perfect.
Here is the example of my draft post object.
$post_field = [
"draftPost" => [
"title" => $topic->topic,
"memberId" => $memberId,
"heroImage" => [
"id" => $image["id"],
"url" => $image["url"],
"altText" => $topic->topic,
],
"richContent" => [
"nodes" => [
[
"type" => "IMAGE",
"id" => "",
"imageData" => [
"containerData" => [
"width" => [
"custom" => "700px",
],
"alignment" => "CENTER",
"spoiler" => [
"enabled" => false,
],
"height" => [
"custom" => "800px",
],
"textWrap" => true,
],
"image" => [
"src" => [
"private" => false,
"url" => $image["url"],
"id" => $image["id"],
],
]
]
],
[
"type" => "HTML",
"id" => "",
"htmlData" => [
"containerData" => [
"width" => [
"custom" => "750px",
"spoiler" => [
"enabled" => true
],
],
"height" => [
"custom" => "12000px"
],
"alignment" => "CENTER"
],
"source" => "HTML",
"html" => "{$topic->fullBlog->content}"
]
]
]
],
"media" => [
"displayed" => true,
"wixMedia" => [
"image" => [
"id" => $image["id"],
"altText" => $topic->topic,
]
]
]
],
"publish" => true,
"fieldsets" => ["URL"]
];
And I got response like that:
{
+"draftPost": {#1858
+"id": "054c1f41-29cb-46a5-9a66-16c013662e55"
+"title": "כיצד לכתוב תוכן איכותי לאתר שלך"
+"featured": false
+"categoryIds": []
+"memberId": "b5067fc4-e561-4a87-928d-527a16b6bcc3"
+"hashtags": []
+"commentingEnabled": true
+"minutesToRead": 0
+"heroImage": {#1869
+"id": "b5067f_01337f08e1d74f46ba9594ef4cb55dfb~mv2.jpeg"
+"url": "https://static.wixstatic.com/media/b5067f_01337f08e1d74f46ba9594ef4cb55dfb~mv2.jpeg"
+"height": 0
+"width": 0
+"altText": "כיצד לכתוב תוכן איכותי לאתר שלך"
+"filename": "pexels-photo-3011842.jpeg"
}
+"tagIds": []
+"relatedPostIds": []
+"pricingPlanIds": []
+"language": "en"
+"changeOrigin": "PUBLISH"
+"contentId": "6565806cbad46847ed41716e"
+"editingSessionId": "b6eeb4f0-6360-4691-8684-aed6f75db8ea"
+"status": "PUBLISHED"
+"mostRecentContributorId": "b5067fc4-e561-4a87-928d-527a16b6bcc3"
+"hasUnpublishedChanges": false
+"editedDate": "2023-11-28T05:53:47.924Z"
+"firstPublishedDate": "2023-11-28T05:53:48.395Z"
+"seoData": {#1876
+"tags": []
}
+"slugs": array:1 [
0 => "כיצד-לכתוב-תוכן-איכותי-לאתר-שלך"
]
+"url": {#1871
+"base": "https://szmithu1.wixsite.com/autoblog"
+"path": "/post/כיצד-לכתוב-תוכן-איכותי-לאתר-שלך"
}
+"createdDate": "2023-11-28T05:53:47.924Z"
+"seoSlug": "כיצד-לכתוב-תוכן-איכותי-לאתר-שלך"
+"media": {#1861
+"wixMedia": {#1842
+"image": {#1860
+"id": "b5067f_01337f08e1d74f46ba9594ef4cb55dfb~mv2.jpeg"
+"url": "https://static.wixstatic.com/media/b5067f_01337f08e1d74f46ba9594ef4cb55dfb~mv2.jpeg"
+"height": 0
+"width": 0
+"altText": "כיצד לכתוב תוכן איכותי לאתר שלך"
+"filename": "pexels-photo-3011842.jpeg"
}
}
+"displayed": true
+"custom": false
}
+"translations": []
}
}