Skip to main content

Hi!!

 

I would appreciate if someone could give me an example of uploading a new image with https://api.miro.com/v2/boards/{board_id}/images described (not completely) in https://developers.miro.com/reference/create-image-item-using-file-from-device

In fact, what I’m trying is duplicating an existing image in a board into a new one. Because its url is private, I cannot use it by speciffying its url so I’m reading its content and trying to upload it in the same way if it would be an image from device.

 

Thanks in advance!!!

Hey @Pepe Cáceres -- I believe the reason your duplication isn’t working is because of the `Image` response object when reading the original image. At this time, the Miro REST API doesn’t return the original image, or even the link to the image, when returning an `Image` object. I’ve included an example `Image` response object below, with some commentary on the links it contains.

We are working on making the original image accessible via the API, though, and there is an issue on our Roadmap that you can subscribe to by voting on it, as well as add your own comments to. Once subscribed, you’ll receive an email for any updates we make on this feature.

In the meantime, you’ll need the image file or a hosting link in order to successfully create an `Image` item on the Miro board.

 

{
id,
data: {
title:
},
position: { ... },
geometry: { ... },
createdAt,
createdBy,
modifiedAt,
modifiedBy,
parent: // The parent item of the image on the Miro board,
links: {
related: // A list of other board items belonging to the same parent item,
self: // The direct link to the image item on the board
},
type: image
}

 

-Joanna


Hi @Joanna Smith !!

Thanks for your response but I think it would be helpful if you provided me with a complete sample of the code in Miro web: https://developers.miro.com/reference/create-image-item-using-file-from-device

Based on that page, it is supposed that there is a way to upload images with the raw data of the image or something similar, is that correct?!

 

Thanks!


Hi @Joanna Smith !!!

 

Any news on this!?

Thanks!!!


Uploading a new image using API v2 is a straightforward process! Make sure to use the correct endpoint and include the image file in the request body. Also, do not forget to check for proper authentication and any size limitations to avoid errors.


Haloo ist jemand da?


It can be a little bit tricky to upload image via API v2 for someone who doesn’t have the basic developer’s knowledge. My team also faced this problem while uploading images on https://reminiiapp.com/remini-web/, a photography based application website. An expert developer suggested us to follow the guide on https://community.miro.com/developer-platform-and-apis-57/how-to-upload-new-image-using-api-v2-9184. Guess what, it worked


Hi ​@Leon Schill ​@Pepe Cáceres ​@Jof 

I’ve just tested this out a few minutes ago and this worked. Make sure to change the resource to be the location of the file. For example, I tried it out with a file called “picture.png” on my Desktop, so the path to that file was /Users/horeaporutiu/Desktop/picture.png. So please change that in your own request.

curl -X "POST" "https://api.miro.com/v2/boards/{add-your-board-id}/images" \
-H "accept: application/json" \
-H "Authorization: Bearer {add-your-access-token}" \
-H "Content-Type: multipart/form-data" \
-F "data={\"position\":{\"x\":3000,\"y\":3000}};type=application/json" \
-F "resource=@/Users/horeaporutiu/Desktop/picture.png;type=image/png"

Please let me know if this worked for you. 


Reply