You will see that we used the --header 'X-Requested-With: XMLHttpRequest' option to make oshi.at respond with JSON format, which we needed in order to find out about the effective download URL using jq -r '.files[0].url. We recognized that you may have implemented it mostly to support the HTML user interface on oshi.at, because it hasn't been documented on the command-line documentation at all.
In this manner, we would like to propose that the JSON response could be generalized and made easier accessible. We have a few suggestions to make the JSON response format available...
a) by honoring the Accept: application/json header, other than the X-Requested-With: XMLHttpRequest header.
b) also for PUT requests. Currently, it only seems to work for POST requests.
c) via request parameter format=json (POST: curl -F format=json and PUT: https://oshi.at/?format=json).
d) by adding the corresponding options (old and new) to the command-line documentation more prominently.
We hope that you will find our suggestions reasonable. Please let us know about your opinion, so that we may submit a patch if you think those improvements would be valuable.
Dear @somenonymous,
first things first: Thank you so much for conceiving this project, for operating oshi.at, and for its excellent command-line documentation.
We've just used oshi.at, with
curl
, within one of our example documentations at ^1.You will see that we used the
--header 'X-Requested-With: XMLHttpRequest'
option to make oshi.at respond with JSON format, which we needed in order to find out about the effective download URL usingjq -r '.files[0].url
. We recognized that you may have implemented it mostly to support the HTML user interface on oshi.at, because it hasn't been documented on the command-line documentation at all.In this manner, we would like to propose that the JSON response could be generalized and made easier accessible. We have a few suggestions to make the JSON response format available...
a) by honoring the
Accept: application/json
header, other than theX-Requested-With: XMLHttpRequest
header. b) also for PUT requests. Currently, it only seems to work for POST requests. c) via request parameterformat=json
(POST:curl -F format=json
and PUT: https://oshi.at/?format=json). d) by adding the corresponding options (old and new) to the command-line documentation more prominently.We hope that you will find our suggestions reasonable. Please let us know about your opinion, so that we may submit a patch if you think those improvements would be valuable.
With kind regards, Andreas.