Skip to main content

Hi,

 

I’m trying to put a image to a Miro board via the REST API (https://developers.miro.com/reference/create-image-item-using-file-from-device).

 

I tried different variants of the code below. Error ranging from 400 to 415.

 

 

        headers = {'Authorization': 'Bearer <token>',

                   'Content-type': 'multipart/form-data',

                   'Accept': 'application/json'}

        json_data_as_json = {

            "title": "title for the image",

            "position": {

                "x": 100,

                "y": 200,

                "origin": "center"

            },

            "geometry": {

                "width": 100,

                "height": 100,

                "rotation": 0

            }

        }

        response = requests.request("POST", url, json=json_data_as_json,

                                    data={'resource': base64.b64encode(open('c:/temp/test.png', 'rb').read())},

                                    headers=headers,

                                    verify=False)

 

 

 Any idea what is wrong?

Or could someone provide a code snippet which works?

 

Thanks and Regards,

Sebastian

No replies yet...

Reply