Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubo HTTP API docs for get lists ignored output parameter #1480

Closed
mrd0ll4r opened this issue Feb 6, 2023 · 2 comments
Closed

Kubo HTTP API docs for get lists ignored output parameter #1480

mrd0ll4r opened this issue Feb 6, 2023 · 2 comments
Assignees
Labels
dif/easy Someone with a little familiarity can pick up effort/hours Estimated to take one or several hours help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up topic/kubo/rpc Issues related to https://docs.ipfs.tech/reference/kubo/rpc/ (generated)

Comments

@mrd0ll4r
Copy link

mrd0ll4r commented Feb 6, 2023

The docs for the /api/v0/get HTTP endpoint, https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-get, list an output parameter, which I believe is ignored:

$ curl -v -X POST "http://127.0.0.1:5001/api/v0/get?arg=/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q&timeout=300s"
*   Trying 127.0.0.1:5001...
* Connected to 127.0.0.1 (127.0.0.1) port 5001 (#0)
> POST /api/v0/get?arg=/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q&timeout=300s HTTP/1.1
> Host: 127.0.0.1:5001
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Content-Type: text/plain
< Server: kubo/0.18.1
< Trailer: X-Stream-Error
< Vary: Origin
< X-Content-Length: 41643
< X-Stream-Output: 1
< Date: Mon, 06 Feb 2023 09:36:04 GMT
< Transfer-Encoding: chunked
<
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
* Failure writing output to destination
* Failed reading the chunked-encoded stream
* Closing connection 0
$ curl -v -X POST "http://127.0.0.1:5001/api/v0/get?arg=/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q&output=/tmp/somefile&timeout=300s"
*   Trying 127.0.0.1:5001...
* Connected to 127.0.0.1 (127.0.0.1) port 5001 (#0)
> POST /api/v0/get?arg=/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q&output=/tmp/somefile&timeout=300s HTTP/1.1
> Host: 127.0.0.1:5001
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Content-Type: text/plain
< Server: kubo/0.18.1
< Trailer: X-Stream-Error
< Vary: Origin
< X-Content-Length: 41643
< X-Stream-Output: 1
< Date: Mon, 06 Feb 2023 09:36:15 GMT
< Transfer-Encoding: chunked
<
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
* Failure writing output to destination
* Failed reading the chunked-encoded stream
* Closing connection 0
$ l /tmp/somefile
ls: cannot access '/tmp/somefile': No such file or directory

See also ipfs/kubo#1210

@mrd0ll4r mrd0ll4r added the need/triage Needs initial labeling and prioritization label Feb 6, 2023
@mrd0ll4r mrd0ll4r changed the title Kubo HTTP API docs for get list ignored output parameter Kubo HTTP API docs for get lists ignored output parameter Feb 6, 2023
@ElPaisano ElPaisano self-assigned this Feb 6, 2023
@ElPaisano
Copy link
Contributor

@lidel it seems like this issue might be related to the automated pages. Any thoughts?

@ElPaisano ElPaisano added the need/maintainers-input Needs input from the current maintainer(s) label Feb 9, 2023
@lidel
Copy link
Member

lidel commented Feb 18, 2023

This is UX bug: we should hide this parameter from the /api/v0 docs.
It makes no sense in the context of HTTP RPC (this parameter is only useful in CLI).

If it does not work, we should just remove it.

How to fix this

If someone has time to do this, we need to extend https://github.com/ipfs/go-ipfs-cmds/ like we did with Status (ipfs/go-ipfs-cmds#225) (here, we would be extendin type Command struct and adding an optional list of parameters that are CLI-only) and then add annotations in https://github.com/ipfs/kubo, and then update generator of https://docs.ipfs.tech/reference/kubo/rpc/ docs (sources in https://github.com/ipfs/ipfs-docs/tree/main/tools/http-api-docs) to skip parameters listed in mentioned annotations.

@lidel lidel added kind/bug A bug in existing code (including security flaws) dif/easy Someone with a little familiarity can pick up P2 Medium: Good to have, but can wait until someone steps up effort/hours Estimated to take one or several hours topic/kubo/rpc Issues related to https://docs.ipfs.tech/reference/kubo/rpc/ (generated) help wanted Seeking public contribution on this issue and removed need/maintainers-input Needs input from the current maintainer(s) need/triage Needs initial labeling and prioritization labels Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dif/easy Someone with a little familiarity can pick up effort/hours Estimated to take one or several hours help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up topic/kubo/rpc Issues related to https://docs.ipfs.tech/reference/kubo/rpc/ (generated)
Projects
None yet
Development

No branches or pull requests

4 participants