Forum Discussion
icassiem
2 years agoPost Prodigy
NetSuite REST API Post working in Postman but battling in PowerBI
Hi,
Using Rest API Post via Postman works using Bearer Token as a test within Postman but tried a lot of things with PowerBI
Can anyone please guide me what I'm doing wrong with the below code, got errrors (400, 405 bad request, credentials for ananymous is incorrect even though the refreshed token works in Postman)
Tried JSON document & fromValue
/*shared NetsuiteConnector.Contents = (url as text) =>*/
let
url = "https://XXX-sb1.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql",
vToken = "Bearer eyJraWQiOiJjLjQ5NTA5OT.....",
suiteapiquery = "SELECT * FROM transactionline",
body = "SELECT * FROM transactionline tl WHERE tl.transaction = 1788003",
//source = Json.Document(Web.Contents(url,[Headers = headers, Query = [q = body]]))
// source = Json.Document(Web.Contents(url ,
//[RelativePath = "reports/rows?auth=" & vToken,
//Headers = [#"Prefer" = "transient", #"Content-Type"="application/json",
Authorization=vToken], //, Query = [q = body]]
//Content= Text.ToBinary(body)
// ]))
Headers = [#"Prefer" = "transient", #"Content-Type"="application/json", Authorization=vToken], /*, Query = [q = body]]*/
postData = Json.FromValue([query = suiteapiquery ]),
response = Web.Contents(url, [Headers = Headers, Content = postData])
in
//source
response
Best to follow the actual documentation. Web.Contents - PowerQuery M | Microsoft Learn
6 Replies
- lbendlinSuper User
Best to follow the actual documentation. Web.Contents - PowerQuery M | Microsoft Learn