ambitious-aqua
ambitious-aqua4mo ago

post body missing invalid content-type or json object has no keys

Hi, guys, just got this problem and double checked with video but still don't know how to fix it. attch the photo
No description
3 Replies
kapa.ai
kapa.ai4mo ago
Hi @Jing_Li. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The information you provided is a bit vague. It would be helpful if you could provide more details about the issue you're facing. However, based on your description, it seems like you might be having issues with the format of your JSON object or the content-type of your request. In the context of Refine, when sending data to the API, you need to ensure that your JSON object is properly formatted and contains keys. For example, when creating a new post, your JSON object might look something like this:
{
"title": "Test",
"image": [
{
"uid": "rc-upload-1620630541327-7",
"name": "greg-bulla-6RD0mcpY8f8-unsplash.jpg",
"url": "<https://refine.ams3.digitaloceanspaces.com/78c82c0b2203e670d77372f4c20fc0e2",>
"type": "image/jpeg",
"size": 70922,
"percent": 100,
"status": "done"
}
]
}
{
"title": "Test",
"image": [
{
"uid": "rc-upload-1620630541327-7",
"name": "greg-bulla-6RD0mcpY8f8-unsplash.jpg",
"url": "<https://refine.ams3.digitaloceanspaces.com/78c82c0b2203e670d77372f4c20fc0e2",>
"type": "image/jpeg",
"size": 70922,
"percent": 100,
"status": "done"
}
]
}
(Source: Refine Documentation (https://refine.dev/docs/advanced-tutorials/upload/multipart-upload#create-form)) Also, ensure that your API endpoint is set to accept Content-type: multipart/form-data if you're sending a file.
{
"file": "binary"
}
{
"file": "binary"
}
(Source: Refine Documentation (https://refine.dev/docs/advanced-tutorials/upload/multipart-upload#create-form)) If you're still having issues, I recommend checking out the Refine Documentation (https://refine.dev/docs) for more information. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4mo ago
<@894445975500890142> kapa.ai is still learning and improving, please let us know how it did by reacting below
ambitious-aqua
ambitious-aqua4mo ago
Sorry still don't know what happened