From c9fd44aa812a9749b4d32ba6b07d07d9e4df1df8 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Tue, 2 Feb 2016 17:13:46 -0500 Subject: [PATCH 1/3] Added Group `id` --- apiary.apib | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) diff --git a/apiary.apib b/apiary.apib index d401009..9c6f5db 100644 --- a/apiary.apib +++ b/apiary.apib @@ -990,6 +990,199 @@ Outputs the list of peers that were removed. # Group id +Prints out information about the specified peer, +if no peer is specified, prints out local peers info. + +'ipfs id' supports the format option for output with the following keys: + : the peers id +: agent version +: protocol version +: public key +: addresses (newline delimited) + +## id [GET /id{?arg}{&format}] +Show IPFS Node ID info + ++ Parameters + + + arg (string, required) - peerID of node to look up + + format (string, optional) - optional output format + ++ Request Without Arguments + + This will default to showing your ID. + + #### curl + + curl -i http://localhost:5001/api/v0/id + + + Body + + ``` + curl -i http://localhost:5001/api/v0/id + ``` + ++ Response 200 + + + Headers + + ``` + Content-Type: application/json + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Tue, 02 Feb 2016 22:10:37 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (object) + + ID (Multihash) + + PublicKey (string) + + Addresses (SwarmAddrs) + + AgentVersion (string) + + ProtocolVersion (string) + + + Body + + ``` + { + "ID": "Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH", + "PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDsXD74cPfcI0dJJzg9N3BApJvlTDmW2GsGfvjmq7Bpm++0JI3LvC3cASPqLb8aiJlynqqzgNkX/xZtAdn0ua63VUWZvamuC2HBEke2IGUF4mkgDdSTaKYMl8NlaSNZDUUthcljZ2aqkdXP+W217U/NjINksYll5IBBPGJqH5Wamb5uNXQM9LQOZSW/qP+T+NoaQGfid21oorHyeSHcugxNdvgPV0RXC6IfZS/1NkupNz2mboXdppKRs3hDKVrtz6/tYGi8kBDvx8susTxw4x8YbRHVnpjh9fIg++PLQUm5xaxQu89YSLsx23Wz3Twq2jg6gi2Tl8GZtgBaZwD9KWLpAgMBAAE=", + "Addresses": [ + "/ip4/127.0.0.1/tcp/4001/ipfs/Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH", + "/ip4/10.0.0.42/tcp/4001/ipfs/Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH", + "/ip6/::1/tcp/4001/ipfs/Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH", + "/ip6/2601:184:4400:78fc:62f8:1dff:fed2:1970/tcp/4001/ipfs/Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH", + "/ip6/2601:184:4400:78fc:d00c:bbbe:d064:a237/tcp/4001/ipfs/Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH", + "/ip4/50.136.95.149/tcp/4001/ipfs/Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH" + ], + "AgentVersion": "go-ipfs/0.4.0-dev", + "ProtocolVersion": "ipfs/0.1.0" + } + 17 + ``` ++ Request With Empty Arguments + + #### curl + + curl -i http://localhost:5001/api/v0/id?arg= + + + Body + + ``` + curl -i http://localhost:5001/api/v0/id?arg= + ``` + ++ Response 400 + + + Headers + + ``` + Content-Type: application/json + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Tue, 02 Feb 2016 22:11:24 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "Invalid peer id" (string) + - Code: 1 (number) + + + Body + + ``` + { + "Message": "Invalid peer id", + "Code": 1 + } + ``` + ++ Request With Invalid Arguments + + #### curl + + curl -i http://localhost:5001/api/v0/config/id?arg=kitten + + + Body + + ``` + curl -i http://localhost:5001/api/v0/config/id?arg=kitten + ``` + ++ Response 500 + + + Headers + + ``` + Content-Type: application/json + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Tue, 02 Feb 2016 22:12:29 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (Error) + - Message: "routing: not found" (string) + - Code: 0 (number) + + + Body + + ``` + { + "Message": "routing: not found", + "Code": 0 + } + ``` + ++ Request With Argument + + #### curl + + curl -i -X POST http://localhost:5001/api/v0/id?arg=QmepgFW7BHEtU4pZJdxaNiv75mKLLRQnPi1KaaXmQN4V1a + + + Body + + ``` + curl -i -X POST http://localhost:5001/api/v0/id?arg=QmepgFW7BHEtU4pZJdxaNiv75mKLLRQnPi1KaaXmQN4V1a + ``` + ++ Response 200 + + + Headers + + ``` + Content-Type: application/json + Trailer: X-Stream-Error + Transfer-Encoding: chunked + Date: Tue, 02 Feb 2016 22:07:08 GMT + Transfer-Encoding: chunked + ``` + + + Attributes (object) + + ID (Multihash) + + PublicKey (string) + + Addresses (SwarmAddrs) + + AgentVersion (string) + + ProtocolVersion (string) + + + Body + + ``` + { + "ID": "QmepgFW7BHEtU4pZJdxaNiv75mKLLRQnPi1KaaXmQN4V1a", + "PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8hSwYY1FXqjT5M36O/Q5fBeDhXE5ePvGAeN3MIibfChqQpgqBbXQi1gAp4TQypSTKl/AMy7hfzsKauieim7jHMgIYAB4pLoBQD1qGVn/n7CqzAR3gDg9umIGuAy15oT0uaqMDqSepfnyxEyPDqfDklgvmS/MAwfBHjH2IPcMIaFgZ6d6gVlhmwuH8WVQ/geumDqyKuU9Jy+SUozmxEu2Baylg4fuqxaxoqOiPFZeWKSCFAngFj3NPmLApE0Fy48/eEZ+t7iP6s/raupP4+Jk/AFNDJNos4VxUnLJpZ1g6W5vYkkt1kXbMTaqxFVryCdCW2UEOwEzjGPGkcIE4RJrHAgMBAAE=", + "Addresses": [ + "/ip4/172.17.0.2/udp/4002/utp", + "/ip4/188.40.116.66/tcp/4001", + "/ip4/127.0.0.1/udp/4002/utp", + "/ip4/172.17.0.2/tcp/4001", + "/ip4/127.0.0.1/tcp/4001" + ], + "AgentVersion": "go-ipfs/0.4.0-dev", + "ProtocolVersion": "ipfs/0.1.0" + } + ``` + # Group init # Group log From 1a68d5c78a380817c69d3c939e8b893d8bbeba09 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Tue, 9 Feb 2016 14:19:59 -0500 Subject: [PATCH 2/3] Update methods, and quotes --- apiary.apib | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/apiary.apib b/apiary.apib index 9c6f5db..98aeb23 100644 --- a/apiary.apib +++ b/apiary.apib @@ -990,8 +990,8 @@ Outputs the list of peers that were removed. # Group id -Prints out information about the specified peer, -if no peer is specified, prints out local peers info. +Prints out information about the specified peer. +If no peer is specified, prints out local peers info. 'ipfs id' supports the format option for output with the following keys: : the peers id @@ -1000,13 +1000,13 @@ if no peer is specified, prints out local peers info. : public key : addresses (newline delimited) -## id [GET /id{?arg}{&format}] +## id [POST /id{?arg}{&format}] Show IPFS Node ID info + Parameters + arg (string, required) - peerID of node to look up - + format (string, optional) - optional output format + + format (string, optional) - Output format. + Request Without Arguments @@ -1014,12 +1014,12 @@ Show IPFS Node ID info #### curl - curl -i http://localhost:5001/api/v0/id + curl -i -X POST "http://localhost:5001/api/v0/id" + Body ``` - curl -i http://localhost:5001/api/v0/id + curl -i -X POST "http://localhost:5001/api/v0/id" ``` + Response 200 @@ -1060,16 +1060,17 @@ Show IPFS Node ID info } 17 ``` + + Request With Empty Arguments #### curl - curl -i http://localhost:5001/api/v0/id?arg= + curl -i -X POST "http://localhost:5001/api/v0/id?arg=" + Body ``` - curl -i http://localhost:5001/api/v0/id?arg= + curl -i -X POST "http://localhost:5001/api/v0/id?arg=" ``` + Response 400 @@ -1101,12 +1102,12 @@ Show IPFS Node ID info #### curl - curl -i http://localhost:5001/api/v0/config/id?arg=kitten + curl -i -X POST "http://localhost:5001/api/v0/config/id?arg=kitten" + Body ``` - curl -i http://localhost:5001/api/v0/config/id?arg=kitten + curl -i -X POST "http://localhost:5001/api/v0/config/id?arg=kitten" ``` + Response 500 @@ -1138,12 +1139,12 @@ Show IPFS Node ID info #### curl - curl -i -X POST http://localhost:5001/api/v0/id?arg=QmepgFW7BHEtU4pZJdxaNiv75mKLLRQnPi1KaaXmQN4V1a + curl -i -X POST "http://localhost:5001/api/v0/id?arg=QmepgFW7BHEtU4pZJdxaNiv75mKLLRQnPi1KaaXmQN4V1a" + Body ``` - curl -i -X POST http://localhost:5001/api/v0/id?arg=QmepgFW7BHEtU4pZJdxaNiv75mKLLRQnPi1KaaXmQN4V1a + curl -i -X POST "http://localhost:5001/api/v0/id?arg=QmepgFW7BHEtU4pZJdxaNiv75mKLLRQnPi1KaaXmQN4V1a" ``` + Response 200 From a4076948293ce72356150fedc2b0afed51be162f Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Tue, 9 Feb 2016 14:41:21 -0500 Subject: [PATCH 3/3] Remove format --- apiary.apib | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/apiary.apib b/apiary.apib index 98aeb23..939db65 100644 --- a/apiary.apib +++ b/apiary.apib @@ -993,20 +993,13 @@ Outputs the list of peers that were removed. Prints out information about the specified peer. If no peer is specified, prints out local peers info. -'ipfs id' supports the format option for output with the following keys: - : the peers id -: agent version -: protocol version -: public key -: addresses (newline delimited) - -## id [POST /id{?arg}{&format}] +## id [POST /id{?arg}] + Show IPFS Node ID info + Parameters + arg (string, required) - peerID of node to look up - + format (string, optional) - Output format. + Request Without Arguments