HTTP API methods
The IPFS documentation lists the IPFS HTTP API methods.
Krypc supports a subset of these which are detailed in this section.
Arguments
Arguments are added through the special query string key arg
:
Note:arg
can be used multiple times to signify multiple arguments.
Flags
Flags commonly used with the IPFS CLI are added through the query string. For example, the --encoding=json
flag is the &encoding=json
query parameter below:
HTTP status codes
Status codes used at the RPC layer are simple:
200
- The request was processed or is being processed (streaming)500
- RPC endpoint returned an error400
- Malformed RPC, argument type error, etc403
- RPC call forbidden404
- RPC endpoint doesn't exist405
- HTTP Method Not Allowed
Status code 500
means that the requested RPC function does exist, but IPFS was not able to fulfill the request because of an error. To know the reason, you have to look at the error message that is usually returned with the body of the response (if no error, check application logs).
Streaming endpoints fail as above, unless they have started streaming. That means they will have sent a 200
status code already. If an error happens during the stream, it will be included in a Trailer
response header (some endpoints may additionally include an error in the last streamed object).
A 405
error may mean that you are using the wrong HTTP method (i.e. GET instead of POST), or that you are not allowed to call that method (i.e. due to CORS restrictions when making a request from a browser).
NDJSON responses
When a bunch of objects are requested, IPFS returns them in the Newline Delimited JSON, NDJSON, format.
This is because the calls are asynchronous and the responses are processed one object at a time.
Last updated