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

Commit

Permalink
docs: HTTP API Status Codes
Browse files Browse the repository at this point in the history
Generated with ipfs-inactive/http-api-docs#23

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
  • Loading branch information
lidel committed Nov 5, 2019
1 parent c08273f commit 9bdb59f
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions content/reference/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ menu:
<!-- TODO: Describe how to change ports and configure the API server -->
<!-- TODO: Structure this around command groups (dag, object, files, etc.) -->

<sup>Generated on 2019-06-22, from go-ipfs v0.4.21.</sup>
<sup>Generated on 2019-11-05, from go-ipfs v0.4.22.</sup>

When an IPFS node is running as a daemon, it exposes an HTTP API that allows
you to control the node and run the same commands you can from the command
Expand All @@ -20,17 +20,21 @@ your program — it allows you to maintain peer connections that are longer
lived than your app and you can keep a single IPFS node running instead of
several if your app can be launched multiple times. In fact, the `ipfs`
CLI commands use this API when operating in [online mode]({{< relref
"usage.md#going-online" >}}).
"usage.md#taking-your-node-online" >}}).

This document is autogenerated from go-ipfs. For issues and support, check out
the [ipfs-http-api-docs](https://github.com/ipfs/ipfs-http-api-docs)
repository on GitHub.
<aside class="alert alert-info">
This document was autogenerated from go-ipfs.<br/>
For issues and support, check out
the <a href="https://github.com/ipfs/ipfs-http-api-docs" target="_blank">ipfs-http-api-docs&nbsp;<i class="fas fa-external-link-square-alt fa-sm"></i></a> repository on GitHub.
</aside>

## Getting started
## Getting Started

### Alignment with CLI Commands

[Every command](../commands/) usable from the CLI is also available through
The HTTP API under `/api/v0/` is an RPC-style API over HTTP, not a REST API.

[Every command]({{< relref "cli.md" >}}) usable from the CLI is also available through
the HTTP API. For example:
```sh
> ipfs swarm peers
Expand Down Expand Up @@ -87,6 +91,19 @@ flag is the `&encoding=json` query parameter below:
}
```

### HTTP Status Codes

Status codes used at the RPC layer are simple:

* `500` - RPC endpoint returned an error
* `404` - RPC endpoint doesn't exist
* `400` - Malformed RPC, argument type error, etc
* `403` - RPC call forbidden

In other words, `500` means that the function _does_ exist, it just failed internally for some reason. To know that reason, you have to look at the "application layer" error (commands lib error).

## HTTP Commands

### /api/v0/add

Add a file or directory to ipfs.
Expand Down

0 comments on commit 9bdb59f

Please sign in to comment.