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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

On CKAN-based site, Web.Contents works with one form of URL, redirects with "versioned" form of URL

Our business uses a CKAN-based website with resource download URLs in two forms:

This standard form that always points to the latest version of a resource: 

https://<ckan site home>/dataset/<dataset id>/resource/<resource id>/download

This versioned form with a /version/ part and version id tacked on that points to specific version of a resource:

https://<ckan site home>/dataset/<dataset id>/resource/<resource id>/version/<version id>/download

 

The standard form of the URL successfully returns data, but the versioned form always redirects to our ckan site's login page.

 

I have tried tacking on the version part using a RelativePath parameter (versus including it in the URL argument), but this does not correct the behavior. FWIW, we do not have any problem accessing a specific version of a resource (using its versioned URL) programatically via the Python or CKANR APIs.

 

Here is the M Query that returns data with a standard URL but redirects to login with a version URL:

 

let
    Source = Web.Contents("<ckan download url>", [Headers=[Authorization="<site access-token>"]])
    Data = Csv.Document(Source, [Delimiter=",", Columns=26, Encoding=1252, QuoteStyle=QuoteStyle.None])
in
    Data

 

Any thoughts? Thanks!

 

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @Anonymous 

The redirection behaviour is down to the webserver and how it's dealing with the HTTP request it receives.  Preumably trying to access a versioned resource in your web browser results in the same redirect behaviour?

 

If you have an API for accessing resources, try using that in PQ to get the data.

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.