Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

POST REST API Call - Error "Access to resource is forbidden"

Hello All,

 

I have used Get calls for my REST API but have yet to refresh a token using a post call. I have the post call working in PostMan

 

The Call is- Post https://secure4.saashr.com/ta/rest/v1/login

Headers - Content-Type application/xml

Body -

<login_request>
    <credentials>
        <username>{{user}}</username>
        <password>{{password}}</password>
        <company>{{company}}</company>
    </credentials>
</login_request>
----------------------------------------------------------------
 
Here is the code I am currently using in Power BI:
let
url = "https://secure4.saashr.com/ta/rest/v1/login",
headers =[#"Content-Type"="application/json",#"Api-Key"="XXXXXXX"],
postData=
"{
""credentials"": {
""username"": ""XXXX"",
""password"": ""XXXX"",
""company"": ""XXXX""
}
}",
data = Text.ToBinary(postData),
response=Json.Document(Web.Contents(url, [Headers=headers,Content=data])),
access_token=response[token]
in
access_token
 
The error I recieve is "Access to the resource is forbidden".However I have accessed multiple times with postman and my get calls all work.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I was silly! I figured out I was incorrectly typing in one of my keys!

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Refer to how it has been used here

https://www.advaiya.com/generate-dynamic-token-and-get-data-from-custom-api-in-power-bi/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Hello, I did follow this blog post. It works perfectly for GET calls but my Post Call is denied access to the resource. Thank you for the response.

Anonymous
Not applicable

I was silly! I figured out I was incorrectly typing in one of my keys!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors