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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lee_hawthorn
Frequent Visitor

Web.Contents() doesn't support status code 308

I am trying to pull in data from predicthq.com.  I'm not connected with this group other than as a data consumer.

 

Their webservice has a 308 redirect.   From the docs I can see Web.Contents() has the required redirection logic for 300-307.

I've tried extending this function with a re-try request having no success - see below.   Python works as does Postman. 

 

Any workarounds for this?    Using Python I've checked the history of the response and I can verify the 308 and the redirection to the final location which happens to be, annoyingly, the same uri as in my original request.    

 

 

 

let req = () =>
    
    let
        
        uri = "https://api.predicthq.com",
        
        utiResponse = Web.Contents(uri, [RelativePath="/v1/events",
            
            Headers = [
                #"Authorization" = "Bearer privatekey",
                #"Accept" = "application/json"
    
            ],
            ManualStatusHandling={308}
        ]),


        finalResponse = Web.Contents(uri, [RelativePath="/v1/events",
            
            Headers = [
                #"Authorization" = "Bearer privatekey",
                #"Accept" = "application/json"
    
            ],ManualStatusHandling={308}
        ])
,

        body = Json.Document(finalResponse)


in body

        in req

 

 

 

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @lee_hawthorn 

Check if it helps.

https://www.tonymcgovern.com/blog/web-api-error-handling/

 


Best Regards
Maggie

Thanks Maggie.   This is a good article, I'll give it a go.

 

Lee

I couldn't get around this bug.   It seems .net http doesn't handle 308 Redirects.  Hence not a Power BI issue, moreover a .net issue.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors