Problem updating a widget via the API: "Unsupported Media Type"

  • 24 April 2021
  • 3 replies

Userlevel 1

I’ve only been using the Miro API for a couple of hours, and I searched the board for a solution to this problem, but nothing came up.

I’m trying to use the API to update sticky notes with new text from an Airtable database. My test code in an Airtable scripting block is successful in retrieving all widgets on a board and isolating those widgets that are sticky notes, but I’ve hit a snag when attempting to update them. The API docs only show a partial code example for updating a widget, and while I can successfully update one of these sticky notes interactively using the “Try It” button in the docs, my code always returns a 415 error: “Unsupported Media Type”. I’m only trying to update the widget text, so I don’t know why this media-type error is coming back.

Here’s how I’m setting up the fetch options:

The docs list a “RAW_BODY” body parameter, but the code example doesn’t show where this should go. I’ve tried adding an outer object with that parameter wrapped around the main object, but that returned the same error. I’ve also removed JSON.stringify() from around the body object and it still returns the same error, so I’m not even sure if the string conversion is necessary.

Can someone please shed some light on how this is supposed to be formatted to update the sticky text correctly?


Best answer by Anthony Roux 27 April 2021, 15:31

View original

3 replies

Userlevel 5
Badge +1



In the headers you need to add the Content-Type:

Content-Type: 'application/json'


Something like:

var options = {
'method': 'PATCH',
'url': url,
'headers': {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
body: JSON.stringify({
"text": text



Userlevel 1

@Anthony Roux Thanks! I wish the documentation showed a full example. All it shows is the raw JSON data being passed, not the full code to make the call. I’m admittedly a little green when it comes to the intricacies of data fetching via JavaScript, so a more detailed example in the docs would help others like me.

Userlevel 5
Badge +1

Point taken. We will work on this to improve the documentation. Thank you very much for the feedback.