Forum Discussion
Refreshing data from REST API
- Anonymous8 years ago
Phoenixke,
When your API requires the use of POST with specific headers to return a successful response, it doesn't support to refresh the dataset in Power BI Service, please vote up the following idea.
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/19033174-scheduled-refresh-should-work-on-web-apis-web-con
Regards,
Lydia
roberthurd: I'm using parameters in mine but you can hardcode if you wish. This one works quite well for me:
let
WFRtoken = "Bearer " & Json.Document(Web.Contents("https://secure.workforceready.eu/ta/rest",
[Headers=[#"Accept"="application/json", #"Content-Type"="application/json", #"Api-Key"="apikey"],
Content=Text.ToBinary("{""credentials"": {""username"": ""user"",""password"": ""pass"",""company"": ""shortname""}}"),
RelativePath = "/v1/login"]))[token]
in
WFRtokenWe just started using Kronos and I have never used API before so am struggling to get us connected. Do you guys have any helpful hints for me or simple steps to show me how to get the connection set up? Kronos has sent me their API page and basically said "Figure it out". I have gotten a connection but only get a document so am not even sure I did that right.
- Phoenixke7 years agoFrequent Visitor
kattlees Depends a bit what you're looking to do but the above should help you to call reports. It also depends on what product you're using from Kronos. Both Workforce Ready and Workforce Dimensions use API's but if I'm not mistaken Workforce Central uses something called WIM (they might have gone to API already, dunno).
This one will give you back a token if you're using WFR, which is the start of everything:
let WFRtoken = "Bearer " & Json.Document(Web.Contents("https://secure.workforceready.eu/ta/rest", [Headers=[#"Accept"="application/json", #"Content-Type"="application/json", #"Api-Key"="your_apikey_here"], Content=Text.ToBinary("{""credentials"": {""username"": ""your_user_here"",""password"": ""your_pass_here"",""company"": ""your_shortname_here""}}"), RelativePath = "/v1/login"]))[token] in WFRtokenIf you're in North America, you'll have to use secure.saashr.com instead of secure.workforceready.eu.