Get request only get header with status code and mime type

Hey,

I try to do some get request, as I am only interested in the status code and the mime type, due to security and traffic I dont want to get the body. Is there any way to do this? I tried the Get request node, as well as the Http retriever and Http result data extractor from palladian. Neither of them seem to work. Any ideads/suggestions?

Hi,
for this you’d need an HTTP OPTIONS request instead of GET. Unfortunately we do not offer a node for that as of now :frowning:
Kind regards
Alexander

Edit: I mixed things up. HEAD is the correct answer, thanks @qqilihq!

2 Likes

You can do this with a HEAD request (must be supported by the server) and the Http Retriever from Palladian. Here’s an example workflow on my NodePit Space:

https://nodepit.com/workflow/com.nodepit.space%2Fqqilihq%2Fpublic%2Fforum%2Fget-request-only-get-header-with-status-code-and-mime-type-22062.knwf

– Philipp

4 Likes

Thank you so much Philipp, this was exactly what I was looking for!
I didn’t find it, would be nice to be able to configure it without a flow variable or table column tho, in my opinion (I guess it would have also helped, if I would have known I am looking for a HEAD request) :slight_smile:.
Still thank you so much for your fast response with an example workflow and your great node package!

2 Likes

Can you tell me what will happen, if the server doesnt support HEAD requests? Status code 405?

This is at the end entirely server-dependent, unfortunately. But a 405 (which means “Method not allowed”) would be a strong indicator, that HEAD requests are indeed not permitted.

There’s probably another dirty workaround (if your main goal is to save traffic): You can do a normal GET and then use the Http Retriever’s “File Size Limitation” and configure a value of e.g. “1 kb”. This will not entirely prevent the download (in fact, the first 1024 bytes are still transferred), but you can save some bandwidth as each request will be stopped after 1 kb. (see updated example workflow linked above):

Hope this helps!

1 Like

Thats what my “solution” was before! :smile:

Why dont you allow, 0 kb? This would make it a nice option in my opinion.

I guess we will try it with the HEAD request and log how it performs and maybe reevaluate in the future.

Thank you!

1 Like

Indeed. This is kind of a bug and we should fix that. I think the issue is, that the first check occurs after the download buffer has been filled the first time.

I’ll see that we fix this in the future :slight_smile:

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.