Replies: 2 comments
-
Hi @janhoy, Before sending a GET request, HttpSource sends a HEAD request to check whether an image exists and is accessible. (In the future it will be able to send a ranged GET instead of HEAD--see #465.) Does your API support HEAD requests? HttpSource tries to employ standard HTTP semantics, which should be compatible with the vast majority of use cases involving RESTful servers. The remaining few are probably either designed incorrectly or are implementing some kind of higher-level protocol logic on top of HTTP that requires similar logic on the client. This API doesn't seem RESTful in the way that it uses HTTP methods in an unusual way (using POST to retrieve things). Consequentially this breaks some things, including ranged requests, which are crucial for some image formats. Ultimately, even if HttpSource could be modified to interact with this API, it would be better to modify the API to support HEAD & GET on image resources, if possible. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer. I hacked up a PR that allowed me to call the HTTP API with POST and while it works, I agree that the lack of ranged requests (which is only supported for GET) is a showstopper for performance. My API is a vendor controlled API to a case management system that has both PDFs and images as attachments, that we'd like to view and cache through Cantaloupe as a proxy. I agree it would be better if they support pure GET API for the specific APIs that allow pure download of these files. Currently they accept the file ID and a few other options in the POST body but it would be trivial to get those from http params. I have abandoned my PR and instead implemented a pre-download from the API to local filesystem cache before passing the image call to Cantaloupe, thus Cantaloupe reads the image/pdf from file system. It's a bit of a hack but works. |
Beta Was this translation helpful? Give feedback.
-
I need to fetch files from a REST API that requires HTTP POST and a very simple JSON body with parameters. The response is a normal binary file stream. Are there plans to extend HttpSource with simple POST capabilities, e.g. with an extension of
httpsource_resource_info
to also support a few new params in the map:{"uri": "https://my/service", "method": "POST", "content_type": "application/json", "body": "post-body-here"}
?Beta Was this translation helpful? Give feedback.
All reactions