How to upload new image using API v2

  • 19 July 2022
  • 3 replies
  • 142 views

Badge +1

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!!!


3 replies

Badge +1

Hi @Joanna Smith !!!

 

Any news on this!?

Thanks!!!

Userlevel 2
Badge

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

Badge +1

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!

Reply