Forum Discussion
mrgou
5 years agoFrequent Visitor
A generic REST API connector?
I need to query data from a REST API but couldn't find any appropriate connector, or even a generic connector. Such a connector should be able to handle requests in any HTTP method, manage authentica...
- Anonymous5 years ago
Hi mrgou,
You can try to use the following M query code if they work on your side:
let rooturl = "https://myserver.com/", //profile id oath_oidc_profile_id = "xxxxxx", //access token from your portal configurations token = "xxxxxxx", relativeURL = "auth/oauth/session/" & oath_oidc_profile_id, //connect to server GetJson = Web.Contents( rooturl, [ Headers = [ #"Authorization" = "Bearer" & token, #"Content-Type" = "application/x-www-form-urlencoded" ], RelativePath = relativeURL ] ), //'session Id' for advanced operation sessionId = Json.Document(GetJson)[sessionId], Source = Web.Contents( rooturl, [ Headers = [ #"Authorization" = "Bearer" & token, #"Content-Type" = "application/x-www-form-urlencoded" ], RelativePath = "xxxx/xxxxx/xxxxx", Content = Text.ToBinary("client_id=" & sessionId) ] ) in SourceIf the above not help, you can also take a look at the following link about pull data from the rest API with authentication:
Pull data from a REST API Authentication
Regards,Xiaoxin Sheng
Anonymous
2 years agoNot applicable
This is not "generic" as it is specific for Zendesk. But it should be possible to make it generic https://community.fabric.microsoft.com/t5/Desktop/Custom-Zendesk-Connector-Power-Query-Code/td-p/2407620.