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 co...
- 2 years ago
Best to follow the actual documentation. Web.Contents - PowerQuery M | Microsoft Learn
icassiem
2 years agoPost Prodigy
hI lbendlin
I'm stuck, somehow to dynamically generate the Nestuite Post for tokens I don't find a solution.
Not sure where to use or get the values for:
- NS OAuth self-signed certificate ID?
- PRIVATE KEY?
- NSTokenId?
- NSTokenSecret?
- client_assertion_type?
- JWT, not sure how and what to do here?
Power Query/PowerBI
let
api_url = https://XXX.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token, //4950992-sb1 = NetSuite CompanyID
consumerkey = "a0ad2d9..",
consumersecret = "1b3c33...",
tokenid = NSTokenId,
tokensecret = NSTokenSecret,
grant_type="client_credentials",
client_assertion_type="urn:...",
ClientID = "a0ad...",
Secret = "1b3c...",
body = "grant_type=" & grant_type & "&client_assertion_type=" & client_assertion_type & "&client_id=" & ClientID & "&client_secret=" & Secret,
EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & Secret), BinaryEncoding.Base64),
Token_Response = Json.Document(Web.Contents(api_url,
[
Headers = [#"Content-Type"="application/x-www-form-urlencoded",#"Authorization"=EncodedCredentials],
Content = Text.ToBinary(body)
]
)),
access_token = Token_Response[access_token]
in
access_token
lbendlin
2 years agoSuper User
As you can probably appreciate it is nearly impossible to help with API queries without access to said API (which you may not be willing to provide for understandable reasons). Good luck.