textiot
Version:
A framework for building web and native (IoT) Dapps on the IPFS network
1,389 lines • 127 kB
JSON
{
"swagger": "2.0",
"info": {
"description": "Textile's HTTP REST API Documentation",
"title": "Textile REST API",
"termsOfService": "https://github.com/textileio/go-textile/blob/master/TERMS",
"contact": {
"name": "Textile",
"url": "https://textile.io/",
"email": "contact@textile.io"
},
"license": {
"name": "MIT License",
"url": "https://github.com/textileio/go-textile/blob/master/LICENSE"
},
"version": "0"
},
"basePath": "/api/v0",
"paths": {
"/account": {
"get": {
"description": "Shows the local peer's account info as a contact",
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Show account contact",
"responses": {
"200": {
"description": "contact",
"schema": {
"$ref": "#/definitions/pb.Contact"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
}
},
"/account/address": {
"get": {
"description": "Shows the local peer's account address",
"produces": [
"text/plain"
],
"tags": [
"account"
],
"summary": "Show account address",
"responses": {
"200": {
"description": "address",
"schema": {
"type": "string"
}
}
}
}
},
"/account/seed": {
"get": {
"description": "Shows the local peer's account seed",
"produces": [
"text/plain"
],
"tags": [
"account"
],
"summary": "Show account seed",
"responses": {
"200": {
"description": "seed",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks": {
"get": {
"description": "Paginates blocks in a thread. Blocks are the raw components in a thread.\nThink of them as an append-only log of thread updates where each update is\nhash-linked to its parent(s). New / recovering peers can sync history by simply\ntraversing the hash tree.",
"produces": [
"application/json"
],
"tags": [
"blocks"
],
"summary": "Paginates blocks in a thread",
"parameters": [
{
"type": "string",
"default": "thread=,offset=,limit=5",
"description": "thread: Thread ID, offset: Offset ID to start listing from (omit for latest), limit: List page size (default: 5)",
"name": "X-Textile-Opts",
"in": "header"
}
],
"responses": {
"200": {
"description": "blocks",
"schema": {
"$ref": "#/definitions/pb.BlockList"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks/{id}": {
"delete": {
"description": "Removes a thread block by ID",
"produces": [
"application/json"
],
"tags": [
"blocks"
],
"summary": "Remove thread block",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"description": "block",
"schema": {
"$ref": "#/definitions/pb.Block"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks/{id}/comment": {
"get": {
"description": "Gets a thread comment by block ID",
"produces": [
"application/json"
],
"tags": [
"blocks"
],
"summary": "Get thread comment",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "comment",
"schema": {
"$ref": "#/definitions/pb.Comment"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks/{id}/comments": {
"get": {
"description": "Lists comments on a thread block",
"produces": [
"application/json"
],
"tags": [
"blocks"
],
"summary": "List comments",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "comments",
"schema": {
"$ref": "#/definitions/pb.CommentList"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Adds a comment to a thread block",
"produces": [
"application/json"
],
"tags": [
"blocks"
],
"summary": "Add a comment",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "urlescaped comment body",
"name": "X-Textile-Args",
"in": "header",
"required": true
}
],
"responses": {
"201": {
"description": "comment",
"schema": {
"$ref": "#/definitions/pb.Comment"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks/{id}/files": {
"get": {
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Gets the metadata for a files block",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "files",
"schema": {
"$ref": "#/definitions/pb.Files"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks/{id}/files/{index}/{path}/content": {
"get": {
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Gets the decrypted file content of a file within a files block",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "file index",
"name": "index",
"in": "path",
"required": true
},
{
"type": "string",
"description": "file path",
"name": "path",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "integer"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks/{id}/files/{index}/{path}/meta": {
"get": {
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Gets the metadata of a file within a files block",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "file index",
"name": "index",
"in": "path",
"required": true
},
{
"type": "string",
"description": "file path",
"name": "path",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "file",
"schema": {
"$ref": "#/definitions/pb.FileIndex"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks/{id}/like": {
"get": {
"description": "Gets a thread like by block ID",
"produces": [
"application/json"
],
"tags": [
"blocks"
],
"summary": "Get thread like",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "like",
"schema": {
"$ref": "#/definitions/pb.Like"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks/{id}/likes": {
"get": {
"description": "Lists likes on a thread block",
"produces": [
"application/json"
],
"tags": [
"blocks"
],
"summary": "List likes",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "likes",
"schema": {
"$ref": "#/definitions/pb.LikeList"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Adds a like to a thread block",
"produces": [
"application/json"
],
"tags": [
"blocks"
],
"summary": "Add a like",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"description": "like",
"schema": {
"$ref": "#/definitions/pb.Like"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/blocks/{id}/meta": {
"get": {
"produces": [
"application/json"
],
"tags": [
"blocks"
],
"summary": "Gets the metadata for a block",
"parameters": [
{
"type": "string",
"description": "block id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "block",
"schema": {
"$ref": "#/definitions/pb.Block"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/cafes": {
"get": {
"description": "List info about all active cafe sessions. Cafes are other peers on the network\nwho offer pinning, backup, and inbox services",
"produces": [
"application/json"
],
"tags": [
"cafes"
],
"summary": "List info about all active cafe sessions",
"responses": {
"200": {
"description": "cafe sessions",
"schema": {
"$ref": "#/definitions/pb.CafeSessionList"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Registers with a cafe and saves an expiring service session token. An access\ntoken is required to register, and should be obtained separately from the target\nCafe",
"produces": [
"application/json"
],
"tags": [
"cafes"
],
"summary": "Register with a Cafe",
"parameters": [
{
"type": "string",
"description": "cafe id",
"name": "X-Textile-Args",
"in": "header",
"required": true
},
{
"type": "string",
"default": "token=",
"description": "token: An access token supplied by the Cafe",
"name": "X-Textile-Opts",
"in": "header"
}
],
"responses": {
"201": {
"description": "cafe session",
"schema": {
"$ref": "#/definitions/pb.CafeSession"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/cafes/messages": {
"post": {
"description": "Check for messages at all cafes. New messages are downloaded and processed\nopportunistically.",
"produces": [
"text/plain"
],
"tags": [
"cafes"
],
"summary": "Check for messages at all cafes",
"responses": {
"200": {
"description": "ok",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/cafes/{id}": {
"get": {
"description": "Gets and displays info about a cafe session. Cafes are other peers on the network\nwho offer pinning, backup, and inbox services",
"produces": [
"application/json"
],
"tags": [
"cafes"
],
"summary": "Gets and displays info about a cafe session",
"parameters": [
{
"type": "string",
"description": "cafe id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "cafe session",
"schema": {
"$ref": "#/definitions/pb.CafeSession"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"delete": {
"description": "Deregisters with a cafe (content will expire based on the cafe's service rules)",
"tags": [
"cafes"
],
"summary": "Deregisters a cafe",
"parameters": [
{
"type": "string",
"description": "cafe id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "ok",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/config": {
"put": {
"description": "Replace entire config file contents. The config command controls configuration\nvariables. It works much like 'git config'. The configuration values are stored\nin a config file inside the Textile repository.",
"consumes": [
"application/json"
],
"tags": [
"config"
],
"summary": "Replace config settings.",
"parameters": [
{
"description": "JSON document",
"name": "config",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/mill.Json"
}
}
],
"responses": {
"204": {
"description": "No Content",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
},
"patch": {
"description": "When patching config values, valid JSON types must be used. For example, a string\nshould be escaped or wrapped in single quotes (e.g., \\\"127.0.0.1:40600\\\") and\narrays and objects work fine (e.g. '{\"API\": \"127.0.0.1:40600\"}') but should be\nwrapped in single quotes. Be sure to restart the daemon for changes to take effect.\nSee https://tools.ietf.org/html/rfc6902 for details on RFC6902 JSON patch format.",
"consumes": [
"application/json"
],
"tags": [
"config"
],
"summary": "Set/update config settings",
"parameters": [
{
"description": "An RFC6902 JSON patch (array of ops)",
"name": "patch",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/mill.Json"
}
}
],
"responses": {
"204": {
"description": "No Content",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
}
},
"/config/{path}": {
"get": {
"description": "Report the currently active config settings, which may differ from the values\nspecifed when setting/patching values.",
"produces": [
"application/json"
],
"tags": [
"config"
],
"summary": "Get active config settings",
"parameters": [
{
"type": "string",
"description": "config path (e.g., Addresses/API)",
"name": "path",
"in": "path"
}
],
"responses": {
"200": {
"description": "new config value",
"schema": {
"$ref": "#/definitions/mill.Json"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
}
},
"/contacts": {
"get": {
"description": "Lists known contacts.",
"produces": [
"application/json"
],
"tags": [
"contacts"
],
"summary": "List known contacts",
"responses": {
"200": {
"description": "contacts",
"schema": {
"$ref": "#/definitions/pb.ContactList"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/contacts/search": {
"post": {
"description": "Search for contacts known locally and on the network",
"produces": [
"application/json"
],
"tags": [
"contacts"
],
"summary": "Search for contacts",
"parameters": [
{
"type": "string",
"default": "local=\"false\",limit=5,wait=5,address=,username=,events=\"false\"",
"description": "local: Whether to only search local contacts, remote: Whether to only search remote contacts, limit: Stops searching after limit results are found, wait: Stops searching after 'wait' seconds have elapsed (max 30s), username: search by username string, address: search by account address string, events: Whether to emit Server-Sent Events (SSEvent) or plain JSON",
"name": "X-Textile-Opts",
"in": "header"
}
],
"responses": {
"200": {
"description": "results stream",
"schema": {
"$ref": "#/definitions/pb.QueryResult"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/contacts/{address}": {
"get": {
"description": "Gets a known contact",
"produces": [
"application/json"
],
"tags": [
"contacts"
],
"summary": "Get a known contact",
"parameters": [
{
"type": "string",
"description": "address",
"name": "address",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "contact",
"schema": {
"$ref": "#/definitions/pb.Contact"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
},
"put": {
"description": "Adds a contact by username or account address to known contacts.",
"consumes": [
"application/json"
],
"tags": [
"contacts"
],
"summary": "Add to known contacts",
"parameters": [
{
"type": "string",
"description": "address",
"name": "address",
"in": "path",
"required": true
},
{
"description": "contact",
"name": "contact",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/pb.Contact"
}
}
],
"responses": {
"204": {
"description": "ok",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
},
"delete": {
"description": "Removes a known contact",
"tags": [
"contacts"
],
"summary": "Remove a contact",
"parameters": [
{
"type": "string",
"description": "address",
"name": "address",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "ok",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/feed": {
"get": {
"description": "Paginates post (join|leave|files|message) and annotation (comment|like) block types\nThe mode option dictates how the feed is displayed:\n\"chrono\": All feed block types are shown. Annotations always nest their target post,\ni.e., the post a comment is about.\n\"annotated\": Annotations are nested under post targets, but are not shown in the\ntop-level feed.\n\"stacks\": Related blocks are chronologically grouped into \"stacks\". A new stack is\nstarted if an unrelated block breaks continuity. This mode is used by Textile\nPhotos. Stacks may include:\n* The initial post with some nested annotations. Newer annotations may have already\nbeen listed.\n* One or more annotations about a post. The newest annotation assumes the \"top\"\nposition in the stack. Additional annotations are nested under the target.\nNewer annotations may have already been listed in the case as well.",
"produces": [
"application/json"
],
"tags": [
"feed"
],
"summary": "Paginates post and annotation block types",
"parameters": [
{
"type": "string",
"default": "thread=,offset=,limit=5,mode=\"chrono\"",
"description": "thread: Thread ID (can also use 'default'), offset: Offset ID to start listing from (omit for latest), limit: List page size (default: 5), mode: Feed mode (one of 'chrono', 'annotated', or 'stacks')",
"name": "X-Textile-Opts",
"in": "header"
}
],
"responses": {
"200": {
"description": "feed",
"schema": {
"$ref": "#/definitions/pb.FeedItemList"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/file/{hash}/content": {
"get": {
"description": "Returns decrypted raw content for file",
"produces": [
"application/octet-stream"
],
"tags": [
"files"
],
"summary": "File content at hash",
"parameters": [
{
"type": "string",
"description": "file hash",
"name": "hash",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/file/{target}/meta": {
"get": {
"description": "Returns the metadata for file",
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "File metadata at hash",
"parameters": [
{
"type": "string",
"description": "file hash",
"name": "hash",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "file",
"schema": {
"$ref": "#/definitions/pb.FileIndex"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/files": {
"get": {
"description": "Paginates thread files. If thread id not provided, paginate all files.",
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Paginates thread files",
"parameters": [
{
"type": "string",
"default": "thread=,offset=,limit=5",
"description": "thread: Thread ID. Omit for all, offset: Offset ID to start listing from. Omit for latest, limit: List page size. (default: 5)",
"name": "X-Textile-Opts",
"in": "header"
}
],
"responses": {
"200": {
"description": "files",
"schema": {
"$ref": "#/definitions/pb.FilesList"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/invites": {
"get": {
"description": "Lists all pending thread invites",
"produces": [
"application/json"
],
"tags": [
"invites"
],
"summary": "List invites",
"responses": {
"200": {
"description": "invites",
"schema": {
"$ref": "#/definitions/pb.InviteViewList"
}
}
}
},
"post": {
"description": "Creates a direct account-to-account or external invite to a thread",
"produces": [
"application/json"
],
"tags": [
"invites"
],
"summary": "Create an invite to a thread",
"parameters": [
{
"type": "string",
"default": "thread=,address=",
"description": "thread: Thread ID (can also use 'default'), address: Account Address (omit to create an external invite)",
"name": "X-Textile-Opts",
"in": "header"
}
],
"responses": {
"201": {
"description": "invite",
"schema": {
"$ref": "#/definitions/pb.ExternalInvite"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/invites/{id}/accept": {
"post": {
"description": "Accepts a direct peer-to-peer or external invite to a thread. Use the key option\nwith an external invite",
"produces": [
"application/json"
],
"tags": [
"invites"
],
"summary": "Accept a thread invite",
"parameters": [
{
"type": "string",
"description": "invite id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"default": "key=",
"description": "key: key for an external invite",
"name": "X-Textile-Opts",
"in": "header"
}
],
"responses": {
"201": {
"description": "join block",
"schema": {
"$ref": "#/definitions/pb.Block"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"409": {
"description": "Conflict",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/invites/{id}/ignore": {
"post": {
"description": "Ignores a direct peer-to-peer invite to a thread",
"produces": [
"application/json"
],
"tags": [
"invites"
],
"summary": "Ignore a thread invite",
"parameters": [
{
"type": "string",
"description": "invite id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
}
},
"/ipfs/cat/{path}": {
"get": {
"description": "Displays the data behind an IPFS CID (hash) or Path",
"produces": [
"application/octet-stream"
],
"tags": [
"ipfs"
],
"summary": "Cat IPFS data",
"parameters": [
{
"type": "string",
"description": "ipfs/ipns cid",
"name"