Answered

Image upload does not use position and parent link property

  • 20 June 2024
  • 5 replies
  • 98 views

Userlevel 1
Badge +1

 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"
}
}
icon

Best answer by Mettin 20 June 2024, 13:34

View original

5 replies

Userlevel 4
Badge +1

Hey @mt0922,

I think you need to change the notation of your CURL. When adding a position here, it adds the coordinates into a data object:

Hope this helps!

Cheers,
Mettin

Userlevel 1
Badge +1

@Mettin 
Thank you.
You mean "Create image item using URL," right? What I'm using is "Create image item using file from device."

Could you please check again?

Userlevel 4
Badge +1

Ah sorry my bad! I talked to the team thats responsible for this endpoint and it seems the docs are wrong and we need to update them asap!

Could you try the following?

curl --request POST \
--url https://api.miro.com/v2/boards/board_id/images \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form data='{"position":{"x":1000,"y":1000}};type=application/json' \
--form resource='@img.png'

 

Userlevel 1
Badge +1

@Mettin 

Thank you very much!

I tried it, and the location information was successfully reflected.

Badge +1

Hi @Mettin 
 

 

curl --request POST \
--url https://api.miro.com/v2/boards/board_id/images \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form data='{"position":{"x":1000,"y":1000}};type=application/json' \
--form resource='@img.png'

 

I try the above, it does not work anymore. Is there any new updates push recently?

Reply