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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
this_is_pk
Regular Visitor

Date as Request Header in API

Hello all,

 

I am new to PBI and looking for some help here.

I am using a GET method to pull the data through API. According to the API documentation a dynamic bearer token is requried for every api call. I was able to fetch the token and when i was able to use it in the Request Headers for API URL. However according to the API documentation a Date Header is required which is UTC timezone to be sent along with Authorization token as Request Headers. Below is the code that i am using. 

 

Source = Value.Metadata(
Web.Contents(BaseURL,

[
Headers=[Authorization = Bearertoken, Date = TodaysDate
]
)),

 

However when i use Date in the Request Header the PBI is throwing an error 

 

Expression.Error: The 'Date' header must be modified using the appropriate property or method.
Parameter name: name
Details:
Sun, 05 May 2024 07:12:37 GMT

 

According the API Documentation the Header name should exactly match to the text whcih is "Date". I tried multiple options but nothing worked out. I also tried in Postman and when i use Date as Header it is working fine and when i change the Date name to any other name such as "Dates" (adding "s" at the end) even in postman i see 401 unauthorized error. I am not sure how to handle this.  Any help is greatly appreciated. 

6 REPLIES 6
bisted
Frequent Visitor

Hi, did you ever resolve this, as I'm having the same issue, with both Date and Host in the header.

lbendlin
Super User
Super User

Can you show the header for the successful Postman request?  Maybe the date format is expected to be in ISO-8601.

It is not the date format that is causing the issue. Its the header (such as column header) . 

For example Date = Sun, 05 May 2024 02:55:55 GMT - this is the format mentioned in API documentation. 

 

The format for date i have is correct but when i use the name "Date" the M query is returning errors. 

 

this_is_pk_0-1714935453435.png

 

 

Error that i am getting is below

 

this_is_pk_0-1714935715832.png

 

Try without the space.  I don't think that is the right date format, btw.

Power BI Access this date format without any issue. Please refer to this link below

 

Representation of date/time values in headers (REST API) - Azure Storage | Microsoft Learn

 

Also according to the API Documentation this is what i have

this_is_pk_0-1714980376048.png

 

 

Its the name of the Header that is causing the issue. You cant directly just write "Date" in M Query. But according the API documentation this is what it should be. Looking for some workaround here

 

 

If you have a Pro license you can open a Pro ticket at https://admin.powerplatform.microsoft.com/newsupportticket/powerbi
Otherwise you can raise an issue at https://community.fabric.microsoft.com/t5/Issues/idb-p/Issues .

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors