Retrieve the name and extension of the image file.

  • 24 January 2023
  • 4 replies
  • 34 views

Badge +1

Is there a way to get the image's file name and extension when using the Rest API or Web SDK? We use Miro for ideation and then wanted to load the data into the source system. 


4 replies

Userlevel 5
Badge +3

Hey @saraTom,

Good question. I believe this should be exposed when you make a GET request to the image’s resource URL via the REST API. 

First, make a GET request to the image itself, such as:
GET https://api.miro.com/v2/boards/{{boardId}}/images

This should return a data object that includes an `imageUrl` field. Next, take this imageUrl and make a subsequent GET request (using the same bearer token), and update the `format` query parameter from its default of “preview” to instead be “original”. So it might look something like this:
GET https://api.miro.com/v2/boards/{{boardId}}/resources/images/{{imageId}}?format=original&redirect=false

And the url returned in the response should include the original file name and extension in it’s parameters.

I hope it helps!
Will

Badge +1

Thanks for responding @Will Bishop 

When I give the original format for retrieving the signed url, I still see only two fields: url and type.

But I see the original name in the url. I can extract that info parsing the url. It would have been nice if original file name is an attribute in the request  

https://r.miro.com/6000000000/25314/132/274/1/original.png?response-content-disposition=attachment%3B%20filename%3D%22bowl2.png%22%3B%20filename%2A%3DUTF-8%27%27bowl2.png&Expires=1674609572&Signature=OxaJpF--xGM9S0pnPQlk5xNTZJcJFsXJYaaAAMCgWIxBSmTJymOj6vW7w839BVXKsZ3yqrGQJ2VY0yGgTjPR~BZWLoYL0d8K0C-AdCeJq8M1GxYWWQ4dnS6N5EJzfKlmBaEbrFk3gQDH2JOcgljBH0U~jxWeaOSMOPXLW6hP2dYHEWk7PQi-x0-y8XgQVscoJdEszy56BwVNrUVMySNv~lc0es4TU3tauiphzaV2WRD5K8qp0u0Uwkc7WqzJ-coYfNQjujzdgi4iQ1uWaHLcIUAY5DW2e4iEdAUeuFYyp9VfbQHBVOEI4-Rt3DLStaG7llVOdEMD2yf0YtlR1Yd9NQ__&Key-Pair-Id=APKAJETO5DMMW7Q7XG6Q

Badge +1

Also I could not find documentation for API end point  for getting images--  in Rest doc

 

Userlevel 5
Badge +3

Thanks for the feedback, @saraTom! I agree it could be a bit easier to access these image file details—I’ve shared this feedback with our product team and hopefully we can improve the experience.

As for the docs, this image resource url is documented under the 200 response example, let me know if it helps!

 

Reply