From 70624932135750230275bf535a1b0b0eef9b1058 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 10:48:45 -0500 Subject: [PATCH 01/20] Init with main desc --- apiary.apib | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apiary.apib b/apiary.apib index 70baa49..caf640b 100644 --- a/apiary.apib +++ b/apiary.apib @@ -3983,6 +3983,19 @@ size is the IPFS link size. } ``` +# Group files +Manipulate unixfs files. + +Files is an API for manipulating ipfs objects as if they were a unix filesystem. + +Note: +Most of the subcommands of 'ipfs files' accept the 'flush' option. It defaults to +true. Use caution when setting this to false. It will improve performance +for large numbers of file operations, but it does so at the cost of consistency +guarantees. + +This command can't be called directly. + # Group get Download IPFS objects. From 084811790c78f3b7e58f87e058674bab1dd5b6a0 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 10:49:34 -0500 Subject: [PATCH 02/20] Added `files rm` --- apiary.apib | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/apiary.apib b/apiary.apib index caf640b..a8b8152 100644 --- a/apiary.apib +++ b/apiary.apib @@ -3996,6 +3996,201 @@ guarantees. This command can't be called directly. +## rm [GET /files/rm{?arg}{&recursive,flush}] +Remove a file. + +### Bugs + +- Recursive seems to default to true. CF: https://github.com/ipfs/go-ipfs/issues/2378 + ++ Parameters + + arg (string, required) - File to remove. + + recursive (boolean, optional) - Recursively remove directories. Alias: r. + + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + ++ Request Without Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/rm" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/rm" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 15:02:04 GMT + Content-Length: 27 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + Argument 'path' is required + ``` + ++ Request With Empty Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/rm?arg=" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/rm?arg=" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 15:02:35 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must not be empty" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must not be empty" + } + ``` + ++ Request With Invalid Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/rm?arg=kitten" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/rm?arg=kitten" + ``` + ++ Response 500 + + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 15:03:10 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must start with a leading slash" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must start with a leading slash" + } + ``` + ++ Request With Argument + + This request is dependent on there being a 'test' file in your Files API folder. + + #### curl + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 15:37:01 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + ++ Request With Argument And Recursive Option + + This request is dependent on there being a 'test' folder in your Files API folder. + + #### curl + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 15:39:19 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + # Group get Download IPFS objects. From e57ac200a63b6b06ea7143cd669f3a47136961c4 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 11:04:12 -0500 Subject: [PATCH 03/20] Added `files flush` Not sure the argument is actually required, if it defaults. --- apiary.apib | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) diff --git a/apiary.apib b/apiary.apib index a8b8152..b348081 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4191,6 +4191,158 @@ Remove a file. ``` ``` +## flush [GET /files/flush{?arg}{&flush}] +Flush a given path's data to disk. + +Flush a given path to disk. This is only useful when other commands +are run with the 'flush' optin set to false. + ++ Parameters + + arg (string, required) - Path to flush. Default: '/'. + ++ Request Without Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/flush" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/flush" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:00:10 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + ++ Request With Empty Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/flush?arg=" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/flush?arg=" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:00:29 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + ++ Request With Invalid Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/flush?arg=kitten" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/flush?arg=kitten" + ``` + ++ Response 500 + + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:00:51 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "file does not exist" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "file does not exist" + } + ``` + ++ Request With Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/flush?arg=/test" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/flush?arg=/test" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:01:27 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + # Group get Download IPFS objects. From 242b9a749664017c089518ec84c857484c9e040f Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 11:12:39 -0500 Subject: [PATCH 04/20] Added `files mv` --- apiary.apib | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) diff --git a/apiary.apib b/apiary.apib index b348081..1290811 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4343,6 +4343,205 @@ are run with the 'flush' optin set to false. ``` ``` +## mv [GET /files/mv{?arg,arg2}{&flush}] +Move files. + +Move files around. Just like traditional unix mv. + ++ Parameters + + arg (string, required) - Source file to move. + + arg2 (string, required) - Target path for file to be moved to. + + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + ++ Request Without Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mv" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mv" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 16:07:11 GMT + Content-Length: 29 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + Argument 'source' is required + ``` + ++ Request With Empty Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mv?arg=&arg=" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mv?arg=&arg=" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:07:57 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must not be empty" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must not be empty" + } + ``` + ++ Request With Invalid Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mv?arg=kitten&arg=kitten" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mv?arg=kitten&arg=kitten" + ``` + ++ Response 500 + + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:08:45 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must start with a leading slash" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must start with a leading slash" + } + ``` + ++ Request With Non-Existent Argument + + This call depends upon a file in the Files API called 'here', which must not exist. + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mv?arg=/here&arg=/there" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mv?arg=/here&arg=/there" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:10:40 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Code: 0 + - Message: "file does not exist" + + + Body + + ``` + { + "Code": 0, + "Message": "file does not exist" + } + ``` + ++ Request With Argument + + This call depends upon a file in the Files API called 'here'. + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mv?arg=/here&arg=/there" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mv?arg=/here&arg=/there" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:09:45 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + # Group get Download IPFS objects. From 9183bd51c1f3b9224a15e5cd8b5741e17502366a Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 11:23:13 -0500 Subject: [PATCH 05/20] Added `files cp` --- apiary.apib | 239 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) diff --git a/apiary.apib b/apiary.apib index 1290811..f533f61 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4542,6 +4542,245 @@ Move files around. Just like traditional unix mv. ``` ``` +## cp [GET /files/cp{?arg,arg2}{&flush}] +Copy files into mfs. + ++ Parameters + + arg (string, required) - Source file to move. + + arg2 (string, required) - Destination to copy object to. + + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + ++ Request Without Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/cp" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/cp" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 16:07:11 GMT + Content-Length: 29 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + Argument 'source' is required + ``` + ++ Request With Empty Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/cp?arg=&arg=" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/cp?arg=&arg=" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:07:57 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must not be empty" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must not be empty" + } + ``` + ++ Request With Invalid Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/cp?arg=kitten&arg=kitten" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/cp?arg=kitten&arg=kitten" + ``` + ++ Response 500 + + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:08:45 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must start with a leading slash" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must start with a leading slash" + } + ``` + ++ Request With Non-Existent Argument + + This call depends upon a file in the Files API called 'here', which must not exist. + + #### curl + + curl -i "http://localhost:5001/api/v0/files/cp?arg=/here&arg=/there" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/cp?arg=/here&arg=/there" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:10:40 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Code: 0 + - Message: "file does not exist" + + + Body + + ``` + { + "Code": 0, + "Message": "file does not exist" + } + ``` + ++ Request With Existenting Argument + + This call depends upon a file in the Files API called 'hest', which must exist. + + #### curl + + curl -i "http://localhost:5001/api/v0/files/cp?arg=/test&arg=/there" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/cp?arg=/test&arg=/there" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:10:40 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Code: 0 + - Message: "directory already has entry by that name" + + + Body + + ``` + { + "Code": 0, + "Message": "directory already has entry by that name" + } + ``` + ++ Request With Argument + + This call depends upon a file in the Files API called 'there', and no 'here' file. + + #### curl + + curl -i "http://localhost:5001/api/v0/files/cp?arg=/there&arg=/here" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/cp?arg=/there&arg=/here" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:21:16 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + # Group get Download IPFS objects. From dff1f8b5d5d3f30905cd4d32ce46fdb59a6e15ce Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 11:34:18 -0500 Subject: [PATCH 06/20] Added `files ls` I'm not sure what -l is doing, or why it adds the hashes and they aren't present elsewhere. But here it is. --- apiary.apib | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) diff --git a/apiary.apib b/apiary.apib index f533f61..7442a4c 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4781,6 +4781,224 @@ Copy files into mfs. ``` ``` +## ls [GET /files/ls{?arg}{&flush}] +List directories. + ++ Parameters + + arg (string, required) - Path to show listing for. + + l (boolean, optional) - Use long listing format. + + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + ++ Request Without Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/ls" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/ls" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 16:27:58 GMT + Content-Length: 27 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + Argument 'path' is required + ``` + ++ Request With Empty Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/ls?arg=" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/ls?arg=" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:30:10 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must not be empty" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must not be empty" + } ``` + ++ Request With Invalid Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/ls?arg=kitten" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/ls?arg=kitten" + ``` + ++ Response 500 + + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:30:12 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must start with a leading slash" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must start with a leading slash" + } + ``` + ++ Request With Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/ls?arg=/" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/ls?arg=/" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:31:10 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (object) + + Entries (array) + + (object) + - Hash (Multihash) + - Name (string) + - Size (number) + - Type (number) + + + Body + + ``` + { + "Entries": [ + { + "Hash": "", + "Name": "test", + "Size": 0, + "Type": 0 + } + ] + } + ``` + ++ Request With Argument And L Option + + #### curl + + curl -i "http://localhost:5001/api/v0/files/ls?arg=/&l=true" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/ls?arg=/&l=true" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:31:10 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (object) + + Entries (array) + + (object) + - Hash (Multihash) + - Name (string) + - Size (number) + - Type (number) + + + Body + + ``` + { + "Entries": [ + { + "Hash": "QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o", + "Name": "test", + "Size": 12, + "Type": 0 + } + ] + } + ``` + # Group get Download IPFS objects. From cf1c793fe7526f6996211bb83f0a43af7dfeaca3 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 11:42:56 -0500 Subject: [PATCH 07/20] Add `files mkdir` I was unable to get `parents` to work as expected. I expect it is a CLI parse. cc @whyrusleeping --- apiary.apib | 237 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 237 insertions(+) diff --git a/apiary.apib b/apiary.apib index 7442a4c..6198a45 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4999,6 +4999,243 @@ List directories. } ``` +## mkdir [GET /files/mkdir{?arg}{&parents,flush}] +Make directories. + +Create the directory if it does not already exist. + +Note: all paths must be absolute. + ++ Parameters + + arg (string, required) - Path to dir to make. + + parents (boolean, optional) - No error if existing, make parent directories as needed. Alias: p. + + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + ++ Request Without Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mkdir" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mkdir" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 16:38:12 GMT + Content-Length: 27 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + Argument 'path' is required + ``` + ++ Request With Empty Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:38:34 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must not be empty" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must not be empty" + } + ``` + ++ Request With Invalid Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=kitten" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=kitten" + ``` + ++ Response 500 + + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:38:37 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must start with a leading slash" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must start with a leading slash" + } + ``` + ++ Request With Existing Directory Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:39:38 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Code: 0 + - Message: "cannot create directory '/': Already exists" + + + Body + + ``` + { + "Code": 0, + "Message": "cannot create directory '/': Already exists" + } + ``` + ++ Request With Existing File Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/test" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/test" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:39:38 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Code: 0 + - Message: "file already exists" + + + Body + + ``` + { + "Code": 0, + "Message": "file already exists" + } + ``` + ++ Request With Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/testing" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/testing" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:39:45 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + # Group get Download IPFS objects. From 7546467756eedd5f574f89bea24ac420f2d2bcab Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 11:53:44 -0500 Subject: [PATCH 08/20] Added `files stat` --- apiary.apib | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) diff --git a/apiary.apib b/apiary.apib index 6198a45..671c949 100644 --- a/apiary.apib +++ b/apiary.apib @@ -5236,6 +5236,171 @@ Note: all paths must be absolute. ``` ``` +## stat [GET /files/stat{?arg}{&flush}] +Display file status. + ++ Parameters + + arg (string, required) - Path to node to stat. + + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + ++ Request Without Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/stat" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/stat" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 16:49:33 GMT + Content-Length: 27 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + Argument 'path' is required + ``` + ++ Request With Empty Argument + + The response is the same if the argument is invalid. For example: + + #### curl + + curl -i "http://localhost:5001/api/v0/files/stat?arg=" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/stat?arg=" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:38:34 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must not be empty" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must not be empty" + } + ``` + ++ Request With Invalid Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/stat?arg=kitten" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/stat?arg=kitten" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:38:37 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must start with a leading slash" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must start with a leading slash" + } + ``` + ++ Request With Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/stat?arg=/" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/stat?arg=/" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:50:59 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (object) + - Blocks (number) + - CumulativeSize (number) + - Hash (Multihash) + - Size (number) + - Type (string) + + + Body + + ``` + { + "Blocks": 2, + "CumulativeSize": 123, + "Hash": "QmZLZmaTGuVBGuuRzqqW7aoigxf1vCjSDgDgZaDNT5xyEi", + "Size": 0, + "Type": "directory" + } + ``` + # Group get Download IPFS objects. From f51d5fb86acf51b190004e1bab409293650bc2aa Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 11:54:02 -0500 Subject: [PATCH 09/20] Remove duplicate lines --- apiary.apib | 6 ------ 1 file changed, 6 deletions(-) diff --git a/apiary.apib b/apiary.apib index 671c949..99e6f64 100644 --- a/apiary.apib +++ b/apiary.apib @@ -2563,7 +2563,6 @@ Run a `FindPeer` query through the DHT. + Response 500 - + Headers ``` @@ -4092,7 +4091,6 @@ Remove a file. + Response 500 - + Headers ``` @@ -4282,7 +4280,6 @@ are run with the 'flush' optin set to false. + Response 500 - + Headers ``` @@ -4437,7 +4434,6 @@ Move files around. Just like traditional unix mv. + Response 500 - + Headers ``` @@ -4634,7 +4630,6 @@ Copy files into mfs. + Response 500 - + Headers ``` @@ -4872,7 +4867,6 @@ List directories. + Response 500 - + Headers ``` From 1bb66012ee7354b45444fbcda7ccb5d88ae5b4fa Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 12:06:13 -0500 Subject: [PATCH 10/20] Add `files read` I may have had too much fun here. --- apiary.apib | 414 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 414 insertions(+) diff --git a/apiary.apib b/apiary.apib index 99e6f64..56bbd6a 100644 --- a/apiary.apib +++ b/apiary.apib @@ -5395,6 +5395,420 @@ Display file status. } ``` +## read [GET /files/read{?arg}{&flush,offset,count}] +Read a file in a given mfs. + +Read a specified number of bytes from a file at a given offset. By default, will +read the entire file similar to unix cat. + ++ Parameters + + arg (string, required) - Path to file to be read. + + offset (number, optional) - Offset to read from. Alias: o. + + count (number, optional) - Maximum number of bytes to read. Alias: n. + + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + ++ Request Without Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 16:49:33 GMT + Content-Length: 27 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + Argument 'path' is required + ``` + ++ Request With Empty Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read?arg=" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read?arg=" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:38:34 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must not be empty" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must not be empty" + } + ``` + ++ Request With Invalid Argument + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read?arg=kitten" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read?arg=kitten" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 16:38:37 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "paths must start with a leading slash" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "paths must start with a leading slash" + } + ``` + ++ Request With Argument + + This depends upon a file in the Files API named 'test' with the content: + + ``` + hello world + ``` + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read?arg=/test" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read?arg=/test" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: text/plain + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + X-Stream-Output: 1 + Date: Fri, 19 Feb 2016 16:58:25 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + hello world + ``` + ++ Request With Argument And Offset Option + + This depends upon a file in the Files API named 'test' with the content: + + ``` + hello world + ``` + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&offset=10" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&offset=10" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: text/plain + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + X-Stream-Output: 1 + Date: Fri, 19 Feb 2016 16:58:25 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + d + ``` + ++ Request With Argument And Invalid Offset Option + + This depends upon a file in the Files API named 'test' with the content: + + ``` + hello world + ``` + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&offset=20" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&offset=20" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 17:03:38 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Code: 0 + - Message: "offset was past end of file (20 > 12)" + + + Body + + ``` + { + "Code": 0, + "Message": "offset was past end of file (20 > 12)" + } + ``` + ++ Request With Argument And Count Option + + This depends upon a file in the Files API named 'test' with the content: + + ``` + hello world + ``` + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=5" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=5" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: text/plain + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + X-Stream-Output: 1 + Date: Fri, 19 Feb 2016 16:58:25 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + hello + ``` + ++ Request With Argument And Invalid Count Option + + This depends upon a file in the Files API named 'test' with the content: + + ``` + hello world + ``` + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=50" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=50" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: text/plain + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + X-Stream-Output: 1 + Date: Fri, 19 Feb 2016 16:58:25 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + hello world + ``` + ++ Request With Argument And Invalid Count or Offset Option Type + + This depends upon a file in the Files API named 'test' with the content: + + ``` + hello world + ``` + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=kitten" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=kitten" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 17:04:31 GMT + Content-Length: 67 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + Could not convert value 'kitten' to type 'int' (for option '-count') + ``` + ++ Request With Argument And Offset And Count Options + + This depends upon a file in the Files API named 'test' with the content: + + ``` + hello world + ``` + + #### curl + + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=5&offset=2" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=5&offset=2" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: text/plain + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + X-Stream-Output: 1 + Date: Fri, 19 Feb 2016 16:58:25 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + llo w + ``` + # Group get Download IPFS objects. From 091a63f08c3b9667d1b71e0bad910a062adcfc5c Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 12:58:31 -0500 Subject: [PATCH 11/20] Added `files write` Lots of issues with this one. --- apiary.apib | 349 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 349 insertions(+) diff --git a/apiary.apib b/apiary.apib index 56bbd6a..7e97fa3 100644 --- a/apiary.apib +++ b/apiary.apib @@ -5809,6 +5809,355 @@ read the entire file similar to unix cat. llo w ``` +## write [POST /files/write{?arg,arg2}{&offset,create,truncate,count,flush}] +Write to a mutable file in a given filesystem. + +Write data to a file in a given filesystem. The entire length of the input will be written. + +If the 'create' option is specified, the file will be created if it does not +exist. Nonexistant intermediate directories will not be created. + +If the 'flush' option is set to false, changes will not be propogated to the +merkledag root. + ++ Parameters + + arg (string, required) - Path to write to. + + arg2 (string, required) - Data to write. + + offset (number, optional) - Offset to write to. Alias: o. + + create (number, optional) - Create the file if it does not exist. Alias: e. + + truncate (boolean, optional) - Truncate the file before writing. Alias: t. + + count (number, optional) - Maximum number of bytes to read. Alias: n. + + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + ++ Request Without Arguments + + #### curl + + curl -i "http://localhost:5001/api/v0/files/write" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/write" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 16:49:33 GMT + Content-Length: 27 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + Argument 'path' is required + ``` + ++ Request With Empty Argument And No Data File + + #### curl + + curl -i "http://localhost:5001/api/v0/files/write?arg=" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/write?arg=" + ``` + ++ Response 400 + + + Headers + + ``` + Date: Fri, 19 Feb 2016 16:49:33 GMT + Content-Length: 27 + Content-Type: text/plain; charset=utf-8 + ``` + + + Attributes (string) + + + Body + + ``` + File argument 'data' is required + ``` + ++ Request With Empty Argument And Data File + + #### curl + + curl -i -X POST -F "data=test" "http://localhost:5001/api/v0/files/write?arg=/test" + + + Body + + ``` + curl -i -X POST -F "data=test" "http://localhost:5001/api/v0/files/write?arg=/test" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 17:42:07 GMT + Connection: close + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Code: 0 + - Message: "paths must not be empty" + + + Body + + ``` + { + "Code": 0, + "Message": "paths must not be empty" + } + ``` + ++ Request With Invalid Argument + + #### curl + + curl -i -X POST -F "data=test" "http://localhost:5001/api/v0/files/write?arg=/" + + + Body + + ``` + curl -i -X POST -F "data=test" "http://localhost:5001/api/v0/files/write?arg=/" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 17:42:05 GMT + Connection: close + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "/ was not a file" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "/ was not a file" + } + ``` + ++ Request With Argument + + #### curl + + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/test" + + + Body + + ``` + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/test" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 17:44:13 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + ++ Request With Argument With Offset Option + + Here, 'test' is a file with the following contents: + + ``` + hello world + ``` + + #### Bugs + + - Currently, offset behaves erratically. See https://github.com/ipfs/go-ipfs/issues/2380 for more. + + #### curl + + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/test&offset=2" + + + Body + + ``` + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/test&offset=2" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 17:44:13 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + ++ Request With Argument With Create Option + + #### curl + + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/kitten&create=true" + + + Body + + ``` + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/kitten&create=true" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 17:44:13 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` ++ Request With Argument With Truncate Option + + #### Bugs + + Due to the lack of a body response, I do not know if this is working correctly. Running `ipfs files read /test` after shows no effect. + + #### curl + + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/test&truncate=true" + + + Body + + ``` + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/test&truncate=true" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 17:44:13 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + ++ Request With Argument With Count Option + + #### Bugs + + Due to the lack of a body response, I do not know if this is working correctly. Running `ipfs files read /test` after shows no effect. + + #### curl + + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/test&count=3" + + + Body + + ``` + curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/test&count=3" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Fri, 19 Feb 2016 17:44:13 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + # Group get Download IPFS objects. From 4e1e6aa294f6064c8be8ad6e0c0c451708eb88ca Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Fri, 19 Feb 2016 12:58:51 -0500 Subject: [PATCH 12/20] Rm is POST --- apiary.apib | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/apiary.apib b/apiary.apib index 7e97fa3..4e271ec 100644 --- a/apiary.apib +++ b/apiary.apib @@ -3995,7 +3995,7 @@ guarantees. This command can't be called directly. -## rm [GET /files/rm{?arg}{&recursive,flush}] +## rm [POST /files/rm{?arg}{&recursive,flush}] Remove a file. ### Bugs @@ -4011,12 +4011,12 @@ Remove a file. #### curl - curl -i "http://localhost:5001/api/v0/files/rm" + curl -i -X POST "http://localhost:5001/api/v0/files/rm" + Body ``` - curl -i "http://localhost:5001/api/v0/files/rm" + curl -i -X POST "http://localhost:5001/api/v0/files/rm" ``` + Response 400 @@ -4041,12 +4041,12 @@ Remove a file. #### curl - curl -i "http://localhost:5001/api/v0/files/rm?arg=" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=" + Body ``` - curl -i "http://localhost:5001/api/v0/files/rm?arg=" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=" ``` + Response 500 @@ -4081,12 +4081,12 @@ Remove a file. #### curl - curl -i "http://localhost:5001/api/v0/files/rm?arg=kitten" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=kitten" + Body ``` - curl -i "http://localhost:5001/api/v0/files/rm?arg=kitten" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=kitten" ``` + Response 500 @@ -4123,12 +4123,12 @@ Remove a file. #### curl - curl -i "http://localhost:5001/api/v0/files/rm?arg=/test" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test" + Body ``` - curl -i "http://localhost:5001/api/v0/files/rm?arg=/test" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test" ``` + Response 200 @@ -4159,12 +4159,12 @@ Remove a file. #### curl - curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + Body ``` - curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" ``` + Response 200 From 847fb098c24bc74f37693c879b5a57d67002a555 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Tue, 23 Feb 2016 13:36:27 -0500 Subject: [PATCH 13/20] Added default, following https://github.com/ipfs/go-ipfs/pull/2391/files --- apiary.apib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiary.apib b/apiary.apib index 4e271ec..630b499 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4780,7 +4780,7 @@ Copy files into mfs. List directories. + Parameters - + arg (string, required) - Path to show listing for. + + arg (string, required) - Path to show listing for. Default: '/'. + l (boolean, optional) - Use long listing format. + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. From 69660f899b7ddce74c6d800094b22400a50d5be6 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Tue, 1 Mar 2016 14:09:30 -0500 Subject: [PATCH 14/20] Update write opts --- apiary.apib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apiary.apib b/apiary.apib index 630b499..2febe4d 100644 --- a/apiary.apib +++ b/apiary.apib @@ -5823,9 +5823,9 @@ merkledag root. + Parameters + arg (string, required) - Path to write to. + arg2 (string, required) - Data to write. - + offset (number, optional) - Offset to write to. Alias: o. + + offset (number, optional) - Byte offset to begin writing at. Alias: o. + create (number, optional) - Create the file if it does not exist. Alias: e. - + truncate (boolean, optional) - Truncate the file before writing. Alias: t. + + truncate (boolean, optional) - Truncate the file to size zero before writing. Alias: t. + count (number, optional) - Maximum number of bytes to read. Alias: n. + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. From 8b507cec0afa03e129f98141c14599e3f63a6df8 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Tue, 1 Mar 2016 16:35:45 -0500 Subject: [PATCH 15/20] Change given update https://github.com/ipfs/go-ipfs/pull/2423 --- apiary.apib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiary.apib b/apiary.apib index 2febe4d..2f3743c 100644 --- a/apiary.apib +++ b/apiary.apib @@ -5403,7 +5403,7 @@ read the entire file similar to unix cat. + Parameters + arg (string, required) - Path to file to be read. - + offset (number, optional) - Offset to read from. Alias: o. + + offset (number, optional) - Byte offset to begin reading from. Alias: o. + count (number, optional) - Maximum number of bytes to read. Alias: n. + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. From c9b398b9f1c27a63b56073506ef4478e3aa36ceb Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Thu, 3 Mar 2016 10:57:12 -0500 Subject: [PATCH 16/20] Added recursive block, removed bug notice, added defaults --- apiary.apib | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/apiary.apib b/apiary.apib index 2f3743c..9ca3692 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4000,11 +4000,9 @@ Remove a file. ### Bugs -- Recursive seems to default to true. CF: https://github.com/ipfs/go-ipfs/issues/2378 - + Parameters + arg (string, required) - File to remove. - + recursive (boolean, optional) - Recursively remove directories. Alias: r. + + recursive (boolean, optional) - Recursively remove directories. Default: false. Alias: r. + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + Request Without Arguments @@ -4153,18 +4151,60 @@ Remove a file. ``` ``` ++ Request With Argument For Directory Without Recursive + + '/test' here must be a directory, not a file. + + #### curl + + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test" + + + Body + + ``` + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Thu, 03 Mar 2016 15:53:27 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "/test is a directory, use -r to remove directories" + - Code: 0 + + + Body + + ``` + { + "Code": 0, + "Message": "/test is a directory, use -r to remove directories" + } + ``` + + Request With Argument And Recursive Option This request is dependent on there being a 'test' folder in your Files API folder. #### curl - curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test&recursive" + Body ``` - curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i -X POST "http://localhost:5001/api/v0/files/rm?arg=/test&recursive" ``` + Response 200 From ea6eb7aa345218a793e891db54a37874fe95fb73 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Thu, 3 Mar 2016 10:59:22 -0500 Subject: [PATCH 17/20] Added defaults, nullable to ls --- apiary.apib | 8 ++++---- test | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 test diff --git a/apiary.apib b/apiary.apib index 9ca3692..c167373 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4821,7 +4821,7 @@ List directories. + Parameters + arg (string, required) - Path to show listing for. Default: '/'. - + l (boolean, optional) - Use long listing format. + + l (boolean, optional) - Use long listing format. Default: false. + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + Request Without Arguments @@ -4961,7 +4961,7 @@ List directories. ``` + Attributes (object) - + Entries (array) + + Entries (array, nullable) + (object) - Hash (Multihash) - Name (string) @@ -4983,7 +4983,7 @@ List directories. } ``` -+ Request With Argument And L Option ++ Request With Argument And List Option #### curl @@ -5011,7 +5011,7 @@ List directories. ``` + Attributes (object) - + Entries (array) + + Entries (array, nullable) + (object) - Hash (Multihash) - Name (string) diff --git a/test b/test new file mode 100644 index 0000000..3b18e51 --- /dev/null +++ b/test @@ -0,0 +1 @@ +hello world From fdb0868bcd63ca428d24fbebe6a0d3eec8023259 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Thu, 3 Mar 2016 11:03:30 -0500 Subject: [PATCH 18/20] Added parents default, examples --- apiary.apib | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/apiary.apib b/apiary.apib index c167373..98bcd20 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4233,7 +4233,7 @@ Remove a file. Flush a given path's data to disk. Flush a given path to disk. This is only useful when other commands -are run with the 'flush' optin set to false. +are run with the 'flush' option set to false. + Parameters + arg (string, required) - Path to flush. Default: '/'. @@ -5042,7 +5042,7 @@ Note: all paths must be absolute. + Parameters + arg (string, required) - Path to dir to make. - + parents (boolean, optional) - No error if existing, make parent directories as needed. Alias: p. + + parents (boolean, optional) - No error if existing, make parent directories as needed. Default: false. Alias: p. + flush (boolean, optional) - Flush target and ancestors after write. Default: true. Alias: f. + Request Without Arguments @@ -5270,6 +5270,81 @@ Note: all paths must be absolute. ``` ``` ++ Request With Embedded Argument and Without Parents Option + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/testing/test/test" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/testing/test/test" + ``` + ++ Response 500 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Thu, 03 Mar 2016 16:00:58 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Code: 0 + - Message: "file does not exist" + + + + Body + + ``` + { + "Code": 0, + "Message": "file does not exist" + } + ``` + ++ Request With Embedded Argument And Parents Option + + #### curl + + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/testing/test/test&parents" + + + Body + + ``` + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/testing/test/test&parents" + ``` + ++ Response 200 + + + Headers + + ``` + Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output + Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + Content-Type: application/json + Server: go-ipfs/0.4.0-dev + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Thu, 03 Mar 2016 16:00:50 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (string) + + + Body + + ``` + ``` + ## stat [GET /files/stat{?arg}{&flush}] Display file status. From f6b980a92403fdd2a04e1c67af18a7522614bd0a Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Thu, 3 Mar 2016 15:31:24 -0500 Subject: [PATCH 19/20] Added tics --- apiary.apib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiary.apib b/apiary.apib index 98bcd20..8994bb0 100644 --- a/apiary.apib +++ b/apiary.apib @@ -3989,7 +3989,7 @@ Files is an API for manipulating ipfs objects as if they were a unix filesystem. Note: Most of the subcommands of 'ipfs files' accept the 'flush' option. It defaults to -true. Use caution when setting this to false. It will improve performance +'true'. Use caution when setting this to 'false'. It will improve performance for large numbers of file operations, but it does so at the cost of consistency guarantees. From d3171c581f1b279ac2a9a7ac088ed3e30ae5fdc4 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Tue, 19 Apr 2016 15:12:58 -0400 Subject: [PATCH 20/20] Updated headers, added prerequisite calls for API checks --- apiary.apib | 601 ++++++++++++++++++++++++++++------------------------ 1 file changed, 320 insertions(+), 281 deletions(-) diff --git a/apiary.apib b/apiary.apib index 8994bb0..774ff96 100644 --- a/apiary.apib +++ b/apiary.apib @@ -4052,18 +4052,17 @@ Remove a file. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 15:02:35 GMT + Date: Tue, 19 Apr 2016 16:42:51 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must not be empty" + - Message: "Paths must not be empty." - Code: 0 + Body @@ -4071,7 +4070,7 @@ Remove a file. ``` { "Code": 0, - "Message": "paths must not be empty" + "Message": "Paths must not be empty." } ``` @@ -4092,18 +4091,17 @@ Remove a file. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 15:03:10 GMT + Date: Tue, 19 Apr 2016 16:43:04 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must start with a leading slash" + - Message: "Paths must start with a leading slash." - Code: 0 + Body @@ -4111,13 +4109,16 @@ Remove a file. ``` { "Code": 0, - "Message": "paths must start with a leading slash" + "Message": "Paths must start with a leading slash." } ``` + Request With Argument This request is dependent on there being a 'test' file in your Files API folder. + To create this file, run: + + url -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" #### curl @@ -4134,13 +4135,12 @@ Remove a file. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 15:37:01 GMT + Date: Tue, 19 Apr 2016 18:41:36 GMT Transfer-Encoding: chunked ``` @@ -4154,6 +4154,9 @@ Remove a file. + Request With Argument For Directory Without Recursive '/test' here must be a directory, not a file. + To create this folder, run: + + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/test" #### curl @@ -4170,13 +4173,12 @@ Remove a file. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Thu, 03 Mar 2016 15:53:27 GMT + Date: Tue, 19 Apr 2016 18:42:34 GMT Transfer-Encoding: chunked ``` @@ -4196,6 +4198,9 @@ Remove a file. + Request With Argument And Recursive Option This request is dependent on there being a 'test' folder in your Files API folder. + To create this folder, run: + + curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/test" #### curl @@ -4212,13 +4217,12 @@ Remove a file. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 15:39:19 GMT + Date: Tue, 19 Apr 2016 18:42:48 GMT Transfer-Encoding: chunked ``` @@ -4230,9 +4234,9 @@ Remove a file. ``` ## flush [GET /files/flush{?arg}{&flush}] -Flush a given path's data to disk. +Flush a given path's data to disk. -Flush a given path to disk. This is only useful when other commands +This is only useful when other commands are run with the 'flush' option set to false. + Parameters @@ -4255,13 +4259,12 @@ are run with the 'flush' option set to false. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:00:10 GMT + Date: Tue, 19 Apr 2016 18:43:15 GMT Transfer-Encoding: chunked ``` @@ -4289,13 +4292,12 @@ are run with the 'flush' option set to false. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:00:29 GMT + Date: Tue, 19 Apr 2016 18:43:25 GMT Transfer-Encoding: chunked ``` @@ -4323,13 +4325,12 @@ are run with the 'flush' option set to false. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:00:51 GMT + Date: Tue, 19 Apr 2016 18:43:35 GMT Transfer-Encoding: chunked ``` @@ -4363,13 +4364,12 @@ are run with the 'flush' option set to false. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:01:27 GMT + Date: Tue, 19 Apr 2016 18:43:46 GMT Transfer-Encoding: chunked ``` @@ -4437,18 +4437,17 @@ Move files around. Just like traditional unix mv. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:07:57 GMT + Date: Tue, 19 Apr 2016 18:44:04 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must not be empty" + - Message: "Paths must not be empty." - Code: 0 + Body @@ -4456,7 +4455,7 @@ Move files around. Just like traditional unix mv. ``` { "Code": 0, - "Message": "paths must not be empty" + "Message": "Paths must not be empty." } ``` @@ -4477,18 +4476,17 @@ Move files around. Just like traditional unix mv. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:08:45 GMT + Date: Tue, 19 Apr 2016 18:44:21 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must start with a leading slash" + - Message: "Paths must start with a leading slash." - Code: 0 + Body @@ -4496,13 +4494,16 @@ Move files around. Just like traditional unix mv. ``` { "Code": 0, - "Message": "paths must start with a leading slash" + "Message": "Paths must start with a leading slash." } ``` + Request With Non-Existent Argument - This call depends upon a file in the Files API called 'here', which must not exist. + This call depends upon a file in the Files API called 'here'. This file must not exist. + To ensure this file does not exist, run: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/here" #### curl @@ -4519,13 +4520,12 @@ Move files around. Just like traditional unix mv. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:10:40 GMT + Date: Tue, 19 Apr 2016 18:44:54 GMT Transfer-Encoding: chunked ``` @@ -4544,7 +4544,9 @@ Move files around. Just like traditional unix mv. + Request With Argument - This call depends upon a file in the Files API called 'here'. + This call depends upon a file in the Files API called 'here'. To create such a file, run: + + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/here" #### curl @@ -4561,13 +4563,12 @@ Move files around. Just like traditional unix mv. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:09:45 GMT + Date: Tue, 19 Apr 2016 18:46:03 GMT Transfer-Encoding: chunked ``` @@ -4603,7 +4604,7 @@ Copy files into mfs. + Headers ``` - Date: Fri, 19 Feb 2016 16:07:11 GMT + Date: Tue, 19 Apr 2016 18:46:14 GMT Content-Length: 29 Content-Type: text/plain; charset=utf-8 ``` @@ -4633,18 +4634,17 @@ Copy files into mfs. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:07:57 GMT + Date: Tue, 19 Apr 2016 18:48:20 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must not be empty" + - Message: "Paths must not be empty." - Code: 0 + Body @@ -4652,7 +4652,7 @@ Copy files into mfs. ``` { "Code": 0, - "Message": "paths must not be empty" + "Message": "Paths must not be empty." } ``` @@ -4673,18 +4673,17 @@ Copy files into mfs. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:08:45 GMT + Date: Tue, 19 Apr 2016 18:48:37 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must start with a leading slash" + - Message: "Paths must start with a leading slash." - Code: 0 + Body @@ -4692,13 +4691,16 @@ Copy files into mfs. ``` { "Code": 0, - "Message": "paths must start with a leading slash" + "Message": "Paths must start with a leading slash." } ``` + Request With Non-Existent Argument This call depends upon a file in the Files API called 'here', which must not exist. + To make sure it does not, run this first: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/here" #### curl @@ -4738,18 +4740,21 @@ Copy files into mfs. } ``` -+ Request With Existenting Argument ++ Request With Existing Argument + + This call depends upon a file in the Files API called 'here', which must exist. + To create this file, run: - This call depends upon a file in the Files API called 'hest', which must exist. + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/here" #### curl - curl -i "http://localhost:5001/api/v0/files/cp?arg=/test&arg=/there" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/here&arg=/there" + Body ``` - curl -i "http://localhost:5001/api/v0/files/cp?arg=/test&arg=/there" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/here&arg=/there" ``` + Response 500 @@ -4757,13 +4762,12 @@ Copy files into mfs. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:10:40 GMT + Date: Tue, 19 Apr 2016 18:54:12 GMT Transfer-Encoding: chunked ``` @@ -4782,16 +4786,20 @@ Copy files into mfs. + Request With Argument - This call depends upon a file in the Files API called 'there', and no 'here' file. + This call depends upon a file in the Files API called 'here', and no 'there' file. + To create this file, run: + + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/here" + curl -i "http://localhost:5001/api/v0/files/rm?arg=/there" #### curl - curl -i "http://localhost:5001/api/v0/files/cp?arg=/there&arg=/here" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/here&arg=/there" + Body ``` - curl -i "http://localhost:5001/api/v0/files/cp?arg=/there&arg=/here" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/here&arg=/there" ``` + Response 200 @@ -4799,13 +4807,12 @@ Copy files into mfs. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:21:16 GMT + Date: Tue, 19 Apr 2016 18:51:23 GMT Transfer-Encoding: chunked ``` @@ -4871,18 +4878,17 @@ List directories. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:30:10 GMT + Date: Tue, 19 Apr 2016 18:54:27 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must not be empty" + - Message: "Paths must not be empty." - Code: 0 + Body @@ -4890,7 +4896,7 @@ List directories. ``` { "Code": 0, - "Message": "paths must not be empty" + "Message": "Paths must not be empty." } ``` + Request With Invalid Argument @@ -4910,18 +4916,17 @@ List directories. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:30:12 GMT + Date: Tue, 19 Apr 2016 18:54:48 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must start with a leading slash" + - Message: "Paths must start with a leading slash." - Code: 0 + Body @@ -4929,7 +4934,7 @@ List directories. ``` { "Code": 0, - "Message": "paths must start with a leading slash" + "Message": "Paths must start with a leading slash." } ``` @@ -4950,13 +4955,12 @@ List directories. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:31:10 GMT + Date: Tue, 19 Apr 2016 18:55:04 GMT Transfer-Encoding: chunked ``` @@ -5000,13 +5004,12 @@ List directories. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:31:10 GMT + Date: Tue, 19 Apr 2016 18:55:19 GMT Transfer-Encoding: chunked ``` @@ -5092,18 +5095,17 @@ Note: all paths must be absolute. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:38:34 GMT + Date: Tue, 19 Apr 2016 18:55:35 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must not be empty" + - Message: "Paths must not be empty." - Code: 0 + Body @@ -5111,7 +5113,7 @@ Note: all paths must be absolute. ``` { "Code": 0, - "Message": "paths must not be empty" + "Message": "Paths must not be empty." } ``` @@ -5133,18 +5135,17 @@ Note: all paths must be absolute. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:38:37 GMT + Date: Tue, 19 Apr 2016 18:55:50 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must start with a leading slash" + - Message: "Paths must start with a leading slash." - Code: 0 + Body @@ -5152,7 +5153,7 @@ Note: all paths must be absolute. ``` { "Code": 0, - "Message": "paths must start with a leading slash" + "Message": "Paths must start with a leading slash." } ``` @@ -5173,13 +5174,12 @@ Note: all paths must be absolute. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:39:38 GMT + Date: Tue, 19 Apr 2016 18:56:04 GMT Transfer-Encoding: chunked ``` @@ -5198,6 +5198,9 @@ Note: all paths must be absolute. + Request With Existing File Argument + This depends upon a file or directory called '/test' already existing. + To ensure this is true, run the command twice. + #### curl curl -i "http://localhost:5001/api/v0/files/mkdir?arg=/test" @@ -5213,13 +5216,12 @@ Note: all paths must be absolute. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:39:38 GMT + Date: Tue, 19 Apr 2016 18:56:19 GMT Transfer-Encoding: chunked ``` @@ -5253,13 +5255,12 @@ Note: all paths must be absolute. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:39:45 GMT + Date: Tue, 19 Apr 2016 18:57:04 GMT Transfer-Encoding: chunked ``` @@ -5287,13 +5288,12 @@ Note: all paths must be absolute. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Thu, 03 Mar 2016 16:00:58 GMT + Date: Tue, 19 Apr 2016 18:57:29 GMT Transfer-Encoding: chunked ``` @@ -5328,13 +5328,12 @@ Note: all paths must be absolute. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Thu, 03 Mar 2016 16:00:50 GMT + Date: Tue, 19 Apr 2016 18:58:05 GMT Transfer-Encoding: chunked ``` @@ -5401,18 +5400,17 @@ Display file status. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:38:34 GMT + Date: Tue, 19 Apr 2016 18:58:20 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must not be empty" + - Message: "Paths must not be empty." - Code: 0 + Body @@ -5420,7 +5418,7 @@ Display file status. ``` { "Code": 0, - "Message": "paths must not be empty" + "Message": "Paths must not be empty." } ``` @@ -5441,18 +5439,17 @@ Display file status. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:38:37 GMT + Date: Tue, 19 Apr 2016 18:58:38 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must start with a leading slash" + - Message: "Paths must start with a leading slash." - Code: 0 + Body @@ -5460,7 +5457,7 @@ Display file status. ``` { "Code": 0, - "Message": "paths must start with a leading slash" + "Message": "Paths must start with a leading slash." } ``` @@ -5481,13 +5478,12 @@ Display file status. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:50:59 GMT + Date: Tue, 19 Apr 2016 18:59:03 GMT Transfer-Encoding: chunked ``` @@ -5569,18 +5565,17 @@ read the entire file similar to unix cat. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:38:34 GMT + Date: Tue, 19 Apr 2016 18:59:19 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must not be empty" + - Message: "Paths must not be empty." - Code: 0 + Body @@ -5588,7 +5583,7 @@ read the entire file similar to unix cat. ``` { "Code": 0, - "Message": "paths must not be empty" + "Message": "Paths must not be empty." } ``` @@ -5609,18 +5604,17 @@ read the entire file similar to unix cat. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 16:38:37 GMT + Date: Tue, 19 Apr 2016 18:59:36 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - - Message: "paths must start with a leading slash" + - Message: "Paths must start with a leading slash." - Code: 0 + Body @@ -5628,7 +5622,7 @@ read the entire file similar to unix cat. ``` { "Code": 0, - "Message": "paths must start with a leading slash" + "Message": "Paths must start with a leading slash." } ``` @@ -5640,6 +5634,11 @@ read the entire file similar to unix cat. hello world ``` + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" + #### curl curl -i "http://localhost:5001/api/v0/files/read?arg=/test" @@ -5655,14 +5654,13 @@ read the entire file similar to unix cat. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked X-Stream-Output: 1 - Date: Fri, 19 Feb 2016 16:58:25 GMT + Date: Tue, 19 Apr 2016 19:02:00 GMT Transfer-Encoding: chunked ``` @@ -5682,6 +5680,11 @@ read the entire file similar to unix cat. hello world ``` + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" + #### curl curl -i "http://localhost:5001/api/v0/files/read?arg=/test&offset=10" @@ -5697,14 +5700,13 @@ read the entire file similar to unix cat. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked X-Stream-Output: 1 - Date: Fri, 19 Feb 2016 16:58:25 GMT + Date: Tue, 19 Apr 2016 19:02:16 GMT Transfer-Encoding: chunked ``` @@ -5724,6 +5726,11 @@ read the entire file similar to unix cat. hello world ``` + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" + #### curl curl -i "http://localhost:5001/api/v0/files/read?arg=/test&offset=20" @@ -5739,26 +5746,25 @@ read the entire file similar to unix cat. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 17:03:38 GMT + Date: Tue, 19 Apr 2016 19:02:55 GMT Transfer-Encoding: chunked ``` + Attributes (Error) - Code: 0 - - Message: "offset was past end of file (20 > 12)" + - Message: "Offset was past end of file (20 > 12)." + Body ``` { "Code": 0, - "Message": "offset was past end of file (20 > 12)" + "Message": "Offset was past end of file (20 > 12)." } ``` @@ -5770,6 +5776,11 @@ read the entire file similar to unix cat. hello world ``` + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" + #### curl curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=5" @@ -5785,14 +5796,13 @@ read the entire file similar to unix cat. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked X-Stream-Output: 1 - Date: Fri, 19 Feb 2016 16:58:25 GMT + Date: Tue, 19 Apr 2016 19:03:33 GMT Transfer-Encoding: chunked ``` @@ -5812,6 +5822,11 @@ read the entire file similar to unix cat. hello world ``` + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" + #### curl curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=50" @@ -5827,14 +5842,13 @@ read the entire file similar to unix cat. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked X-Stream-Output: 1 - Date: Fri, 19 Feb 2016 16:58:25 GMT + Date: Tue, 19 Apr 2016 19:03:53 GMT Transfer-Encoding: chunked ``` @@ -5854,6 +5868,11 @@ read the entire file similar to unix cat. hello world ``` + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" + #### curl curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=kitten" @@ -5890,6 +5909,11 @@ read the entire file similar to unix cat. hello world ``` + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" + #### curl curl -i "http://localhost:5001/api/v0/files/read?arg=/test&count=5&offset=2" @@ -5905,14 +5929,13 @@ read the entire file similar to unix cat. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked X-Stream-Output: 1 - Date: Fri, 19 Feb 2016 16:58:25 GMT + Date: Tue, 19 Apr 2016 19:04:25 GMT Transfer-Encoding: chunked ``` @@ -6006,6 +6029,8 @@ merkledag root. + Request With Empty Argument And Data File + This request depends upon no file in the Files API at '/test', and an empty file 'test'. + #### curl curl -i -X POST -F "data=test" "http://localhost:5001/api/v0/files/write?arg=/test" @@ -6021,27 +6046,26 @@ merkledag root. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 17:42:07 GMT + Date: Tue, 19 Apr 2016 19:06:29 GMT Connection: close Transfer-Encoding: chunked ``` + Attributes (Error) - Code: 0 - - Message: "paths must not be empty" + - Message: "file does not exist" + Body ``` { "Code": 0, - "Message": "paths must not be empty" + "Message": "file does not exist" } ``` @@ -6049,7 +6073,7 @@ merkledag root. #### curl - curl -i -X POST -F "data=test" "http://localhost:5001/api/v0/files/write?arg=/" + curl -i -X POST -F "data=test" "http://localhost:5001/api/v0/files/write?arg=/" + Body @@ -6062,13 +6086,12 @@ merkledag root. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 17:42:05 GMT + Date: Tue, 19 Apr 2016 19:08:01 GMT Connection: close Transfer-Encoding: chunked ``` @@ -6088,6 +6111,12 @@ merkledag root. + Request With Argument + This request depends upon a file '/test' existing in the Files API, and a file 'test' existing locally. + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" + #### curl curl -i -X POST -F "data=@test" "http://localhost:5001/api/v0/files/write?arg=/test" @@ -6103,13 +6132,12 @@ merkledag root. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 17:44:13 GMT + Date: Tue, 19 Apr 2016 19:09:16 GMT Transfer-Encoding: chunked ``` @@ -6128,9 +6156,10 @@ merkledag root. hello world ``` - #### Bugs + To make sure that this exists, run the following: - - Currently, offset behaves erratically. See https://github.com/ipfs/go-ipfs/issues/2380 for more. + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" #### curl @@ -6147,13 +6176,12 @@ merkledag root. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 17:44:13 GMT + Date: Tue, 19 Apr 2016 19:10:19 GMT Transfer-Encoding: chunked ``` @@ -6181,13 +6209,12 @@ merkledag root. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 17:44:13 GMT + Date: Tue, 19 Apr 2016 19:10:37 GMT Transfer-Encoding: chunked ``` @@ -6199,9 +6226,16 @@ merkledag root. ``` + Request With Argument With Truncate Option - #### Bugs + Here, '/test' is a file with the following contents: + + ``` + hello world + ``` - Due to the lack of a body response, I do not know if this is working correctly. Running `ipfs files read /test` after shows no effect. + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" #### curl @@ -6218,13 +6252,12 @@ merkledag root. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 17:44:13 GMT + Date: Tue, 19 Apr 2016 19:10:49 GMT Transfer-Encoding: chunked ``` @@ -6237,9 +6270,16 @@ merkledag root. + Request With Argument With Count Option - #### Bugs + Here, '/test' is a file with the following contents: - Due to the lack of a body response, I do not know if this is working correctly. Running `ipfs files read /test` after shows no effect. + ``` + hello world + ``` + + To make sure that this exists, run the following: + + curl -i "http://localhost:5001/api/v0/files/rm?arg=/test&recursive=true" + curl -i "http://localhost:5001/api/v0/files/cp?arg=/ipfs/QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o&arg=/test" #### curl @@ -6256,13 +6296,12 @@ merkledag root. + Headers ``` - Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output - Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output + 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: application/json - Server: go-ipfs/0.4.0-dev + Server: go-ipfs/0.4.1-dev Trailer: X-Stream-Error - Transfer-Encoding: chunked - Date: Fri, 19 Feb 2016 17:44:13 GMT + Date: Tue, 19 Apr 2016 19:11:32 GMT Transfer-Encoding: chunked ```