-
Notifications
You must be signed in to change notification settings - Fork 22
Conversation
+ chunker (boolean, optional) - chunking algorithm to use | ||
+ pin (boolean, optional) - Pin this object when adding. Default true | ||
|
||
+ Response 200 (text/plain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was unable to get "http://127.0.0.1:5001/api/v0/add?arg=/Users/richard/test" to work on Postman, so I honestly am not sure if this is the right response of not. It's what I get in the CLI, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path to a file will not work from http api, you have to send the file content via multipart if you want to add something via http
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to test adds in Postman, you can use the form-data
body Content-Type, set a non-empty value for the key, and select 'File' instead of 'Text'.
In curl, you can do:
curl -F "file=@/some/file/path" http://localhost:5001/api/v0/add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, could be cool to show curl
commands for all these methods, does apiary have any good places where we could put that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no option to select File instead of Text if I am using a GET command. If I use a PUT or a POST, there is, but I just get a 403 - Forbidden
back. Ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could include the curl command directly in the description, like this. I like it! What do you think? cc @dignifiedquire
# Group add [GET /add{?arg}{&recursive,quiet,silent,progress,trickle,only%2Dhash,wrap%2Dwith%2Ddirectory,hidden,chunker,pin}]
Add an object to ipfs.
Adds contents of <path> to ipfs. Use -r to add directories.
Note that directories are added recursively, to form the ipfs
MerkleDAG. A smarter partial add with a staging area (like git)
remains to be implemented.
#### curl
curl -F "file=@test/" -r http://localhost:5001/api/v0/add
+ Parameters
+ arg (string, required) - The path to a file to be added to IPFS
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from @RichardLitt: There's no option to select File instead of Text if I am using a GET command. If I use a PUT or a POST, there is, but I just get a 403 - Forbidden back. Ideas?
That would be because no one (i.e Apiary) is expecting for a file to be sent in a GET request and all the other methods are blocked by CORS, if the headers are not set.
db59060
to
438dd5d
Compare
This one, in particular, is not great, but this should be a good start. There's a few things in the `ipfs object` docs that are inconsistent; for instance, I'm not sure that <name> and <ref> aren't options. The "--encoding" flag is mentioned several times, but never specified as an option, unless it is in `put`, where it has the name `inputenc`, which I think does something different. The formatting is also a bit inconsistent - tick marks given here but not there, and so on. I think I'll need to comb over this in more detail later. For now, here's a stub. Better to have something than nothing.
d3ab6d0
to
3804212
Compare
It seems strange to me that pin/rm has the same 200 response as pin/add. But that seems to be the case.
db49ab7
to
096a0d3
Compare
I got a malformed syntax error when trying refs on Postman, but it seemed to work fine in the command line. I am not sure what exactly is happening with the format option, and I suspect that coud be improved a bit. Otherwise, this seems fine to me. Threw in headers because I might as well, they were right there.
I didn't get a response in my terminal for tarcat, so I assume there is none. I was unable to get tar/add to work, as well, in Postman, but in the terminal it returned the hash of the file, so that is probably what it returns there, too.
Ok, I've finished going through all of the commands for the first time. Now is the harder bit; which is, namely, figuring out why some don't work in the API at all, where the inconsistencies are in the documentation, and how to clean up and make this, as a whole, better. For now, though, I think this is a massive step forward. Can someone give a brief overview of my work here, point out any glaring issues? |
This, of course, relates and possibly closes #7. |
|
||
<link base58 hash> | ||
|
||
Note: list all refs recursively with -r. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cli notation
This is not the result I got back from Postman, as I wasn't able to make it work there. Here is the curl response.
21bd4ce
to
afc33e5
Compare
7f1905c
to
13ff0c9
Compare
@dignifiedquire Want to take another pass? |
Removed 'needs review' pending current changes ongoing after the API talk. |
Please do not close or delete this branch. I am using it to stub out future PRs. This PR will not and should not be merged. |
So far: