Working with PowerBI to create some charts from IC2 data in different format to that in IC2 for a customer.
Trying to get oauth2 token details in IC2 using m code as below but no matter what I do I only get back 400 bad request. I know the client_id, client_secret are OK as I can run curl OK and construct a POST command that runs as expected from Fiddler OK.
I think my issue is that the POST statement that gets sent is not appending the postdata correctly to the call. Any ideas welcome.
GetAPIToken = ( client_id, client_secret as text) =>
postdata = “client_id=” & client_id & “&client_secret=” & client_secret & “&grant_type=client_credentials”,
URL = “https://api.ic.peplink.com/api/oauth2/token”,
DataQuery= Web.Contents( URL, [Headers = [#“ContentType” = “application/x-www-form-urlencoded”], #“Content” = Text.ToBinary(postdata)]),
DataOut = Json.Document(DataQuery),
source = DataOut