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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Web.Contents executed twice?

Hi,

I have a problem getting data from REST API. Here's some background:

 

I'm trying to get data from REST API with Web.Contents. This API requires md5 hashed code and each call has to be unique (hashed code can be used only once). URL and md5 hashed code are generated in Power BI before calling the API and everything is fine so far. But each Web.Contents call returns error message REQUEST_NOT_UNIQUE: Unique hashed code is already used.

 

Next lines are from Power BI log. It seems that Web.Contents is executed twice.

 

Line 2384: DataMashup.Trace Information: 24579 : {"Start":"2017-12-19T11:43:53.4206534Z","Action":"Engine/IO/Web/Request/GetResponse","HostProcessId":"18160","RequestMethod":"GET","RequestUri":"XXXXX?StartDate=2010-01-01&EndDate=2017-12-01","RequestHasContent":"False","RequestHasHeaders":"True","RequestHasTimeout":"True","UseCache":"True","ResponseStatusCode":"200","ProductVersion":"2.53.4954.481...


Line 2385: DataMashup.Trace Information: 24579 : {"Start":"2017-12-19T11:43:53.6923237Z","Action":"Engine/IO/Web/Request/GetResponse","HostProcessId":"18160","RequestMethod":"GET","RequestUri":"XXXXX?StartDate=2010-01-01&EndDate=2017-12-01","RequestHasContent":"False","RequestHasHeaders":"True","RequestHasTimeout":"True","UseCache":"True","ResponseStatusCode":"200","ProductVersion":"2.53.4954.481...

 

Any ideas how to fix this or is there any possible workarounds to get the data from API?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

This one is solved. API was limited to max 500 rows per call and and error message for slightly misleading.

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

Can you post your M code?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Here is the M code.

 

Timestamp, md5 hash and end date come from SQL Server and each list contains only one value. Other values come from static parameters.

 

If I change parameter values then I get different error message about incorrect http headers / values. So it seems that the URL generated right, but for some reason I always get error message about not unique request.

 

let
	
		sender = "PBI",
		customerID = vCustomerId,
		partnerID = vPartnerId,
		kieli = vKieli,
		orga = vYTunnus,
        trID = "-tositteet",

                Source = Xml.Tables(Web.Contents("https://yyyy.com/nnn.nv", 

                        [Headers=[
                            #"X-Authentication-Sender"=sender, 
                            #"X-Authentication-CustomerId"=customerID, 
                            #"X-Authentication-PartnerId"=partnerID, 
                            #"X-Authentication-Timestamp"=List.First(timestamp), 
                            #"X-Interface-Language"=kieli, 
                            #"X-Organisation-ID"=orga, 
                            #"X-Authentication-TransactionId"=List.First(timestamp) & trID, 
                            #"X-Authentication-MAC"=List.First(md5_hash)], 

                            Query=[StartDate="2010-01-01", EndDate=List.First(endDate)]
                        ])),

    #"Expanded Table" = Table.ExpandTableColumn(Source, "Table", {"Status", "TimeStamp"}, {"Table.Status", "Table.TimeStamp"}),
    #"Expanded Table.Status" = Table.ExpandTableColumn(#"Expanded Table", "Table.Status", {"Element:Text"}, {"Table.Status.Element:Text"})
in
    #"Expanded Table.Status"

 

Anonymous
Not applicable

This one is solved. API was limited to max 500 rows per call and and error message for slightly misleading.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors