Skip to main content
Answered

Unable to get CARD metadata with REST API

  • September 8, 2020
  • 1 reply
  • 888 views

tkat0

Hi community.

 

I want to develop an application that use card metadata.

Unfortunately, I can add metadata to the card with JavaScript SDK, but I can’t get it with REST API.

Do you know why?

 

Reproduction procedure

(0) Create Application

https://developers.miro.com/docs/getting-started

(1) Create a card with SDK

await miro.board.widgets.create({
    type: "card",
    text: "test card",
    metadata: {
        [appId]: {
            hoge: true,
        },
    }
})

(2) Get the card with REST API

curl --request GET \  --url https://api.miro.com/v1/boards/${board_id}/widgets/${widget_id}\  --header 'authorization: Bearer ${token}'

→ No metadata

 

Thank you.

Best answer by Daniela Gavidia

Hello,

I just tested this and it works if you make the call in the code for your web-plugin, like this:
 

miro.board.widgets.create({
    type: "sticker",
    text: "TEST",
    metadata: {
        "1234567890471107053": {
            data: "test data",
        },
    }
})

However, if you are calling the SDK from your browser Javascript console, you have to make sure that you set the right Javascript context. You should choose your web-plugin as the context, otherwise it won’t work. Like this:
 


See also:

https://stackoverflow.com/questions/53426995/firefox-dev-tools-change-js-execution-context
 

I hope this helps.

Kind regards.

 

Daniela

Developer Experience Team @ Miro

View original
Was it helpful?

1 reply

Daniela Gavidia
Mironeer
Forum|alt.badge.img

Hello,

I just tested this and it works if you make the call in the code for your web-plugin, like this:
 

miro.board.widgets.create({
    type: "sticker",
    text: "TEST",
    metadata: {
        "1234567890471107053": {
            data: "test data",
        },
    }
})

However, if you are calling the SDK from your browser Javascript console, you have to make sure that you set the right Javascript context. You should choose your web-plugin as the context, otherwise it won’t work. Like this:
 


See also:

https://stackoverflow.com/questions/53426995/firefox-dev-tools-change-js-execution-context
 

I hope this helps.

Kind regards.

 

Daniela

Developer Experience Team @ Miro


Reply