Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Added block and its subcommands #25

Merged
merged 2 commits into from
Feb 9, 2016
Merged

Added block and its subcommands #25

merged 2 commits into from
Feb 9, 2016

Conversation

RichardLitt
Copy link
Contributor

@@ -0,0 +1,3 @@
1
" � :�^�E���p��\�|�.��t|d��U��cat.jpg�
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably here by mistake, no?

@daviddias
Copy link
Contributor

This is looking gooood ! :)

@RichardLitt
Copy link
Contributor Author

@diasdavid updated, removed those files. Good call.

@daviddias daviddias mentioned this pull request Feb 2, 2016
13 tasks
@daviddias
Copy link
Contributor

LGTM :)

@dignifiedquire
Copy link
Collaborator

LGTM

@RichardLitt
Copy link
Contributor Author

I changed quite a bit, probably should have put it as a diff instead of force pushing. I'll need another lookover, there were a few errors with that last one.

diff --git a/apiary.apib b/apiary.apib
index 72b5e2f..6349871 100644
--- a/apiary.apib
+++ b/apiary.apib
@@ -405,9 +405,12 @@ MerkleDAG.
 ## wantlist

 # Group block
+
 Manipulate raw IPFS blocks.

-+ Request No Methods
+## block [GET /block]
+
++ Request Without Subcommands

     #### curl

@@ -446,7 +449,7 @@ Manipulate raw IPFS blocks.
         }
         ```

-## get [GET /block/get{?arg}]
+## get [POST /block/get{?arg}]

 Store data as a raw ipfs block.

@@ -457,12 +460,12 @@ Store data as a raw ipfs block.

     #### curl

-        curl -i http://localhost:5001/api/v0/block/stat
+        curl -i http://localhost:5001/api/v0/block/get

     + Body

         ```
-        curl -i http://localhost:5001/api/v0/block/stat
+        curl -i http://localhost:5001/api/v0/block/get
         ```

 + Response 400
@@ -475,22 +478,28 @@ Store data as a raw ipfs block.
         Content-Type: text/plain; charset=utf-8
         ```

+    + Attributes (string)
+
     + Body

         ```
         Argument 'key' is required
         ```

-+ Request Invalid Argument
++ Request With Empty Argument
+
+    The response is the same if the argument is invalid. For instance:
+
+        curl -i http://localhost:5001/api/v0/block/get?arg=kitten

     #### curl

-        curl -i http://localhost:5001/api/v0/block/stat?arg=
+        curl -i http://localhost:5001/api/v0/block/get?arg=

     + Body

         ```
-        curl -i http://localhost:5001/api/v0/block/stat?arg=
+        curl -i http://localhost:5001/api/v0/block/get?arg=
         ```

 + Response 500
@@ -524,29 +533,29 @@ Store data as a raw ipfs block.

     #### curl

-        curl -i http://localhost:5001/api/v0/block/stat?arg=QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
+        curl -i http://localhost:5001/api/v0/block/get?arg=QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o

     + Body

         ```
-        curl -i http://localhost:5001/api/v0/block/stat?arg=QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
+        curl -i http://localhost:5001/api/v0/block/get?arg=QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
         ```

-+ Response 200 (text/plain)
++ Response 200

     + Headers

         ```
-        Access-Control-Allow-Headers: X-Stream-Ouptut, X-Chunked-Output
-        Access-Control-Expose-Headers: X-Stream-Ouptut, X-Chunked-Output
         Content-Type: text/plain
         Trailer: X-Stream-Error
         Transfer-Encoding: chunked
         X-Stream-Output: 1
-        Date: Fri, 29 Jan 2016 21:42:59 GMT
+        Date: Thu, 04 Feb 2016 22:51:40 GMT
         Transfer-Encoding: chunked
         ```

+    + Attributes (string)
+
     + Body

         ```
@@ -554,14 +563,15 @@ Store data as a raw ipfs block.
         ```

 ## put [POST /block/put{?arg}]
+
 Stores input as an IPFS block

-ipfs block put is a plumbing command for storing raw ipfs blocks.
+'ipfs block put' is a plumbing command for storing raw IPFS blocks.

 + Parameters
     + arg (string, required) - The data to be stored as an IPFS block.

-+ Request No Arguments
++ Request Without Arguments

     #### curl

@@ -583,6 +593,8 @@ ipfs block put is a plumbing command for storing raw ipfs blocks.
         Content-Type: text/plain; charset=utf-8
         ```

+    + Attributes (string)
+
     + Body

         ```
@@ -591,6 +603,10 @@ ipfs block put is a plumbing command for storing raw ipfs blocks.

 + Request Invalid Argument (multipart/form-data)

+    The response is the same if there is no data provided. For example:
+
+        curl -i -F "data=" http://localhost:5001/api/v0/block/put
+
     #### curl

         curl -i -F "data=invalid" http://localhost:5001/api/v0/block/put
@@ -630,6 +646,10 @@ ipfs block put is a plumbing command for storing raw ipfs blocks.

 + Request Valid Argument (multipart/form-data)

+    In the example provided, the 'test' file has the following contents:
+
+        hello world
+
     #### curl

         curl -i -F "data=@test" http://localhost:5001/api/v0/block/put
@@ -667,13 +687,13 @@ ipfs block put is a plumbing command for storing raw ipfs blocks.
         }
         ```

-## stat [GET /block/stat?{arg}]
+## stat [POST /block/stat?{arg}]
 Retrieve information on a raw ipfs block.

 + Parameters
     + arg (Multihash, required) - Hash of the block to retrieve stats on.

-+ Request No Arguments
++ Request Without Arguments

     #### curl

@@ -703,14 +723,18 @@ Retrieve information on a raw ipfs block.

 + Request Invalid Argument

+    The response is the same if there is no argument provided. For example:
+
+        curl -i -F "data=" http://localhost:5001/api/v0/block/stat/arg=
+
     #### curl

-        curl -i http://localhost:5001/api/v0/block/stat/arg=
+        curl -i http://localhost:5001/api/v0/block/stat/arg=kitten

     + Body

         ```
-        curl -i http://localhost:5001/api/v0/block/stat/arg=
+        curl -i http://localhost:5001/api/v0/block/stat/arg=kitten
         ```

 + Response 400


#### curl

curl -i http://localhost:5001/api/v0/block/put
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is doing a get request, for post

curl -X POST http://localhost:5001/api/v0/block/put

@daviddias
Copy link
Contributor

giving my 👍 again, other than that small detail on the curl command

And also added `-X POST` where needed to POST requests.
RichardLitt added a commit that referenced this pull request Feb 9, 2016
Added `block` and its subcommands
@RichardLitt RichardLitt merged commit e6bafe5 into master Feb 9, 2016
@RichardLitt RichardLitt deleted the feature/block branch February 9, 2016 18:46
@RichardLitt
Copy link
Contributor Author

Thanks, all!

@RichardLitt
Copy link
Contributor Author

This closes block in #20

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants