Forum Discussion

musicbydannyd's avatar
musicbydannyd
Advocate IV
4 years ago

REST API-UKG (saashr.com)

Hi all... I have a question posted on Stack Overflow (https://stackoverflow.com/questions/72305239/rest-api-ukg-saashr-com-using-power-query), which goes like this:

 

Newbie to REST API here and struggling with authentication using Power Query (M). Trying to get UKG (saashr.com) payroll data token... their REST API guide is here: https://secure.saashr.com/ta/docs/rest/public/

I've tried hard coding credentials (with "anonymous" data source permissions) using the following code:

 

let UKGToken = Json.Document(Web.Contents("https://secure.saashr.com/ta/rest/v1/login", [Headers=[#"Accept"="application/json", #"Content-Type"="application/json", #"Api-Key"="987654321abcdefg"], Content=Text.ToBinary("{""credentials"": {""username"": ""Username1"",""password"": ""Password1"",""company"": ""123456""}}")]))[token] in UKGToken

 

But, I am getting "Expression.Error: Access to the resource is forbidden."

Also tried removing username/password from headers and entering credentials in data source settings with no luck.

TIA, Danny

2 Replies