Using Chrome dev tools to get SharePoint API calls in JSON

When working with Power Automate I wanted an easy way to get the JSON version of an API call.

When looking at a normal API link in a webpage you get XML

https://xomino.sharepoint.com/sites/SPFest2019/_api/web/lists/getbytitle('MarkyList')/items

To be able to see the output in JSON we can use Chrome Dev Tools to call the same page and pass in the apporpriate header to turn it into JSON

fetch(location.href, {
  method: 'GET',
  headers: {
    'Accept': "application/json;odata=verbose"
  }
})
.then(res => res.text())
.then(console.log)

And from this you can get the output quickly from the console

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s