Hello
Currently I am using this API request to upload a file from devise to an mirro boad.
Create image item using file from device - https://api.miro.com/v2/boards/{board_id}/images
But I have notice in response that passed parameters from forma-data is not applied to the image that was uploaded recently. But everything is working fine if use image link not a file to upload to boad.
Is it a bug or feature?)
It has been resolved on our end.
I am also facing the same issue. I am sending the request as shown below from the documentation, but for some reason, both x and y in the response are returned as 0.
I am not sure if this is a bug or an intended behavior.
request
curl --request POST \
--url https://api.miro.com/v2/boards/board_id/images \
--header 'accept: application/json' \
--header 'authorization: Bearer xxxxxx' \
--header 'content-type: multipart/form-data' \
--form x=1000 \
--form y=1000 \
--form resource='@img1.png'
response
{
"id": "xxxxxxxxxxxx",
"type": "image",
"data": {
"imageUrl": "https://api.miro.com/v2/boards/board_id/resources/images/xxxxx?format=preview&redirect=false"
},
"geometry": {
"width": 1024,
"height": 1024
},
"position": {
"x": 0,
"y": 0,
"origin": "center",
"relativeTo": "canvas_center"
},
"links": {
"self": "https://api.miro.com/v2/boards/board_id/images/xxxxxxxxxxxxx"
},
"createdAt": "2024-06-19T10:37:26Z",
"createdBy": {
"id": "xxxxxxxxxxxxxxx",
"type": "user"
},
"modifiedAt": "2024-06-19T10:37:26Z",
"modifiedBy": {
"id": "xxxxxxxxxxxxxxxxx",
"type": "user"
}
}
I have tried something like this but get an error
data.json
{
"data": {
"title": "TestName"
},
"position": {
"x": 2000,
"y": 2000
},
"parent": {
"id": "parentId"
}
}
Hi
no I have not send in this way
I send like at the example according to documentation https://developers.miro.com/reference/create-image-item-using-local-file-2
curl --location 'https://api.miro.com/v2/boards/{boardId}/images' \
--header 'accept: application/json' \
--header 'authorization: Bearer {token}' \
--form 'x="2500"' \
--form 'y="2000"' \
--form 'id="parentId"' \
--form 'title="test"' \
--form 'resource=@"/{pathToFile}"'
can you send example of data parameter
How should it looks like?
Hey
Thanks for reaching out, and happy to help. As a first step, can I kindly ask that you double check how you’re passing the JSON body?
This endpoint expects the following field names (keys) for the multipart/form-data:
`resource` for the image file upload
`data` for the JSON file upload
And when using this endpoint, the JSON body must be uploaded as a file (.json) to be properly read by the request. Can you confirm this is how you’re uploading the JSON?
Here is an example in cURL:
curl --location --request PATCH 'https://api.miro.com/v2/boards/{boardId}/images/{imageId}' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer {token}' \
--form 'resource=@"/{pathToFile}"' \
--form 'data=@"/{pathToFile}"'
Let me know, thanks!
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.