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

Commit

Permalink
Added group cat
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLitt committed Feb 18, 2016
1 parent 01abdcf commit ec365ca
Showing 1 changed file with 164 additions and 0 deletions.
164 changes: 164 additions & 0 deletions apiary.apib
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,170 @@ Outputs the list of peers that were removed.

# Group cat

Show IPFS object data

## cat [GET /cat{?arg}]
Retrieves the object named by <ipfs-or-ipns-path> and outputs the data it contains.

+ Parameters
+ arg (string, required) - The path to the IPFS object or objects to be outputted

+ Response 200

+ Headers

```
Transfer-Encoding: chunked
X-Stream-Output: 1
```

+ Request Without Arguments

#### curl

curl -i "http://localhost:5001/api/v0/cat"

+ Body

```
curl -i "http://localhost:5001/api/v0/cat"
```

+ Response 400

+ Headers

```
Date: Fri, 05 Feb 2016 17:14:24 GMT
Content-Length: 32
Content-Type: text/plain; charset=utf-8
```

+ Attributes (string)

+ Body

```
Argument 'ipfs-path' is required
```

+ Request With Empty Argument

The response is the same if there is an invalid argument. For example:

curl -i "http://localhost:5001/api/v0/cat?arg=kitten"

#### curl

curl -i "http://localhost:5001/api/v0/cat?arg="

+ Body

```
curl -i "http://localhost:5001/api/v0/cat?arg="
```

+ Response 500

+ Headers

```
Content-Type: application/json
Trailer: X-Stream-Error
Transfer-Encoding: chunked
Date: Fri, 05 Feb 2016 17:14:49 GMT
Transfer-Encoding: chunked
```

+ Attributes (Error)
- Message: "invalid ipfs ref path"
- Code: 0

+ Body

```
{
"Message": "invalid ipfs ref path",
"Code": 0
}
```

+ Request With Valid Argument But Invalid DAG Node

The multihash in this request is for a directory, not for an object.

#### curl

curl -i "http://localhost:5001/api/v0/cat?arg=QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ"

+ Body

```
curl -i "http://localhost:5001/api/v0/cat?arg=QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ"
```

+ Response 500

+ Headers

```
Content-Type: application/json
Trailer: X-Stream-Error
Transfer-Encoding: chunked
Date: Fri, 05 Feb 2016 17:16:07 GMT
Transfer-Encoding: chunked
```

+ Attributes (Error)
- Message: "this dag node is a directory"
- Code: 0

+ Body

```
{
"Message": "this dag node is a directory",
"Code": 0
}

+ Request With Valid Argument

In this request, 'QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o' is the hash for a file, 'test',
with the following contents

hello world

#### curl

curl -i "http://localhost:5001/api/v0/cat?arg=QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o"

+ Body

```
curl -i "http://localhost:5001/api/v0/cat?arg=QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o"
```

+ Response 200

+ Headers

```
Content-Type: text/plain
Trailer: X-Stream-Error
Transfer-Encoding: chunked
X-Stream-Output: 1
Date: Fri, 05 Feb 2016 17:18:10 GMT
Transfer-Encoding: chunked
```

+ Attributes (string)

+ Body

```
hello world
```

# Group commands

# Group config
Expand Down

0 comments on commit ec365ca

Please sign in to comment.