Skip to content

Commit

Permalink
Update api.md
Browse files Browse the repository at this point in the history
Added changes from ipfs-inactive/docs#368
  • Loading branch information
jessicaschilling authored Nov 5, 2019
1 parent 08b6ef5 commit fd46464
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions docs/reference/http/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: HTTP API
<!-- TODO: Describe how to change ports and configure the API server -->
<!-- TODO: Structure this around command groups (dag, object, files, etc.) -->

_Generated on 2019-06-22, from go-ipfs v0.4.21._
_Generated on 2019-11-05, from go-ipfs v0.4.22._

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 @@ -17,17 +17,19 @@ In many cases, using this API this is preferable to embedding IPFS directly in
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](usage.md#going-online).
CLI commands use this API when operating in online mode.

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.
::: tip
This document was autogenerated from go-ipfs. For issues and support, check out the [a href="https://github.com/ipfs/ipfs-http-api-docs](ipfs-http-api-docs) repository on GitHub.
:::

## 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](/reference/cli/) usable from the CLI is also available through
the HTTP API. For example:

```sh
Expand Down Expand Up @@ -85,6 +87,16 @@ 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 fd46464

Please sign in to comment.