I’m trying to emulate the request to get all widgets from the “List All Widgets - Try It” page locally. I have an index.js file that is linked in a html file. All the index.js contains is:
const options = {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: 'Bearer <access token>'
}
};
fetch('https://api.miro.com/v1/boards/<board id>%3D/widgets/?widgetType=sticker', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
But whenever I make the request all I get is TypeError: Failed to fetch
What am I doing wrong here? Is the endpoint incorrect? Am I supposed to be adding additional fields to the options?
I tried making a request through Postman using that endpoint and the access token that was provided when the app was made and the request works. I just don’t get what’s wrong with this fetch request :(