Forum Discussion
michal_blazek
8 years agoRegular Visitor
Status code checker - 404, 200, 301, 302
Hi, please can anybody hlep me, hot to get 301 or 302 status of web urls? I have found this custom function: (urlToCheck as text)=>
let
Source = Value.Metadata(Web.Contents(urlToCheck, [Manua...
v-chuncz-msft
8 years agoCommunity Support
- michal_blazek8 years agoRegular Visitor
Hi v-chuncz-msft,
but this field only define, which part from metadata I have to chcek. When I define it without "ManualStatusHandling" and without [Response.Status], I got whole metadata table (record):
- Content.Type (everytime: text/html)
- Content.Uri (everytime: Function)
- Content.Name (original not redirected URL)
- Headers (after expanding record: everytime: text/html; charset=UTF-8)
- Request.Option (everytime null)
- Response.Status (everytime final response = 200 / 404)
Problem is that by this setting I everytime got on the "final" page = "final" response. So I do not have the info about 301 / 302, but info from final page with final response (and it is 200). I'd like to know, which url's are 301 or 302 and in ideal way, what is the final redirection. Do you understand me?
let Source= Excel.CurrentWorkbook(){[Name="Table"]}[Content], #"Change type" = Table.TransformColumnTypes(Source,{{"url", type text}}), #"Add metadata content" = Table.AddColumn(#"Change type", "new", each Value.Metadata(Web.Contents([url]))), #"Expand metadata" = Table.ExpandRecordColumn(#"Add metadata content", "new", {"Content.Type", "Content.Uri", "Content.Name", "Headers", "Request.Options", "Response.Status"}, {"Content.Type", "Content.Uri", "Content.Name", "Headers", "Request.Options", "Response.Status"}), #"Expand Headers" = Table.ExpandRecordColumn(#"Expand metadata", "Headers", {"Content-Type"}, {"Content-Type"}) in #"Expand Headers"
THX a lot.