Power Query M code
let
Source = Json.Document(Web.Contents("https://api.example.com/v1/sales", [Headers = [Authorization = "Bearer YOUR_TOKEN"]])),
ConvertedToTable = Table.FromRecords(Source[data])
in
ConvertedToTable
Calls a JSON REST API and converts the response into a table.
let
Source = Json.Document(Web.Contents("https://api.example.com/v1/sales", [Headers = [Authorization = "Bearer YOUR_TOKEN"]])),
ConvertedToTable = Table.FromRecords(Source[data])
in
ConvertedToTable
Tidy JSON with the JSON Formatter
Replace the URL and Authorization header with your API's actual details, and Source[data] with the field name that holds the array of records in the response.
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Retrieve Data from a REST API.