Forum Discussion
Easy POST requests with Power BI and Power Query using Json.FromValue - Errors
Hi Ryan_OC ,
I am surprised about all the hightlighted brackets in your code. Usually, I would expect to see "simple" strings in those positions:
let
Source = (Records) =>
let
Key = “{API Key}”, //this is the API for the live environment
CompanyID = “XXXXXX”, //this is the company code
Method = “DetailedLedgerTransaction”, //this is from the Sage Accounting API Specification
WebAddress = “https://accounting.sageone.co.za/api/2.0.0/”, //This is the webaddress for the live environment
url = Json.Document(Web.Contents(WebAddress & Method & “/Get?apikey=” & Key & “&CompanyID=” & CompanyID)),
header = [#”Content-Type”=”application/json”,#”Accept”=”application/json”], //not sure about this header???
body = Json.FromValue([ Inactive = [ true ], Active = [ true ], FromAccount = {“”}, ToAccount = {“”}, IncludeNoTax = [ true ], FromDate = {“2021-12-30”}, ToDate = {“2021-12-30”}]),
Source = Json.Document(Web.Contents(url,[Headers = header,Content=body])
in
Source
in
Source