description:A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data.
SPR:
type:string
description:Signed Peer Record (libp2p)
SPRRead:
type:object
required:
- spr
properties:
spr:
$ref:"#/components/schemas/SPR"
PeerIdRead:
type:object
properties:
id:
$ref:"#/components/schemas/PeerId"
Content:
type:object
required:
- cid
description:Parameters specifying the content
properties:
cid:
$ref:"#/components/schemas/Cid"
Node:
type:object
required:
- nodeId
- peerId
- record
- address
- seen
properties:
nodeId:
type:string
peerId:
type:string
record:
type:string
address:
type:string
seen:
type:boolean
CodexVersion:
type:object
properties:
version:
type:string
example:v0.1.7
revision:
type:string
example:0c647d8
PeersTable:
type:object
required:
- localNode
- nodes
properties:
localNode:
$ref:"#/components/schemas/Node"
nodes:
type:array
items:
$ref:"#/components/schemas/Node"
DebugInfo:
type:object
required:
- id
- addrs
- repo
- spr
- announceAddresses
- table
- codex
properties:
id:
$ref:"#/components/schemas/PeerId"
addrs:
type:array
items:
$ref:"#/components/schemas/MultiAddress"
repo:
type:string
description:Path of the data repository where all nodes data are stored
description:Number that represents expiry threshold in seconds from when the Request is submitted. When the threshold is reached and the Request does not find requested amount of nodes to host the data, the Request is voided. The number of seconds can not be higher then the Request's duration itself.
description:Max slots that can be lost without data considered to be lost
StorageRequest:
type:object
required:
- id
- client
- ask
- content
- expiry
- nonce
properties:
id:
type:string
description:Request ID
client:
$ref:"#/components/schemas/EthereumAddress"
ask:
$ref:"#/components/schemas/StorageAsk"
content:
$ref:"#/components/schemas/Content"
expiry:
$ref:"#/components/schemas/Expiry"
nonce:
type:string
description:Random data
Purchase:
type:object
required:
- state
- requestId
properties:
state:
type:string
description:Description of the Request's state
enum:
- cancelled
- error
- failed
- finished
- pending
- started
- submitted
- unknown
error:
type:string
nullable:true
description:If Request failed, then here is presented the error message
request:
$ref:"#/components/schemas/StorageRequest"
requestId:
$ref:"#/components/schemas/Id"
DataList:
type:object
required:
- content
properties:
content:
type:array
items:
$ref:"#/components/schemas/DataItem"
DataItem:
type:object
required:
- cid
- manifest
properties:
cid:
$ref:"#/components/schemas/Cid"
manifest:
$ref:"#/components/schemas/ManifestItem"
ManifestItem:
type:object
required:
- treeCid
- datasetSize
- blockSize
- protected
properties:
treeCid:
$ref:"#/components/schemas/Cid"
description:"Unique data identifier"
datasetSize:
type:integer
format:int64
description:"Length of original content in bytes"
blockSize:
type:integer
description:"Size of blocks"
protected:
type:boolean
description:"Indicates if content is protected by erasure-coding"
filename:
type:string
nullable:true
description:"The original name of the uploaded content (optional)"
example:codex.png
mimetype:
type:string
nullable:true
description:"The original mimetype of the uploaded content (optional)"
example:image/png
Space:
type:object
required:
- totalBlocks
- quotaMaxBytes
- quotaUsedBytes
- quotaReservedBytes
properties:
totalBlocks:
description:"Number of blocks stored by the node"
type:integer
format:int64
quotaMaxBytes:
type:integer
format:int64
description:"Maximum storage space (in bytes) available for the node in Codex's local repository."
quotaUsedBytes:
type:integer
format:int64
description:"Amount of storage space (in bytes) currently used for storing files in Codex's local repository."
quotaReservedBytes:
type:integer
format:int64
description:"Amount of storage reserved (in bytes) in the Codex's local repository for future use when storage requests will be picked up and hosted by the node using node's availabilities. This does not include the storage currently in use."
servers:
- url:"http://localhost:8080/api/codex/v1"
tags:
- name:Marketplace
description:Marketplace information and operations
- name:Data
description:Data operations
- name:Node
description:Node management
- name:Debug
description:Debugging configuration
paths:
"/connect/{peerId}":
get:
summary:"Connect to a peer"
description:|
If `addrs` param is supplied, it will be used to dial the peer, otherwise the `peerId` is used
to invoke peer discovery, if it succeeds the returned addresses will be used to dial.
tags:[Node]
operationId:connectPeer
parameters:
- in:path
name:peerId
required:true
schema:
$ref:"#/components/schemas/PeerId"
description:Peer that should be dialed.
- in:query
name:addrs
schema:
type:array
nullable:true
items:
$ref:"#/components/schemas/MultiAddress"
description:|
If supplied, it will be used to dial the peer.
The address has to target the listening address of the peer,
which is specified with the `--listen-addrs` CLI flag.
responses:
"200":
description:Successfully connected to peer
"400":
description:Peer either not found or was not possible to dial
"/data":
get:
summary:"Lists manifest CIDs stored locally in node."
tags:[Data]
operationId:listData
responses:
"200":
description:Retrieved list of content CIDs
content:
application/json:
schema:
$ref:"#/components/schemas/DataList"
"400":
description:Invalid CID is specified
"404":
description:Content specified by the CID is not found
"422":
description:The content type is not a valid content type or the filename is not valid
"500":
description:Well it was bad-bad
post:
summary:"Upload a file in a streaming manner. Once finished, the file is stored in the node and can be retrieved by any node in the network using the returned CID."
tags:[Data]
operationId:upload
parameters:
- name:content-type
in:header
required:false
description:The content type of the file. Must be valid.
schema:
type:string
example:"image/png"
- name:content-disposition
in:header
required:false
description:The content disposition used to send the filename.
schema:
type:string
example:'attachment; filename="codex.png"'
requestBody:
content:
application/octet-stream:
schema:
type:string
format:binary
responses:
"200":
description:CID of uploaded file
content:
text/plain:
schema:
type:string
"500":
description:Well it was bad-bad and the upload did not work out
"/data/{cid}":
get:
summary:"Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned."
tags:[Data]
operationId:downloadLocal
parameters:
- in:path
name:cid
required:true
schema:
$ref:"#/components/schemas/Cid"
description:File to be downloaded.
responses:
"200":
description:Retrieved content specified by CID
content:
application/octet-stream:
schema:
type:string
format:binary
"400":
description:Invalid CID is specified
"404":
description:Content specified by the CID is unavailable locally
"500":
description:Well it was bad-bad
"/data/{cid}/network":
post:
summary:"Download a file from the network to the local node if it's not available locally. Note: Download is performed async. Call can return before download is completed."
tags:[Data]
operationId:downloadNetwork
parameters:
- in:path
name:cid
required:true
schema:
$ref:"#/components/schemas/Cid"
description:"File to be downloaded."
responses:
"200":
description:Manifest information for download that has been started.
content:
application/json:
schema:
$ref:"#/components/schemas/DataItem"
"400":
description:Invalid CID is specified
"404":
description:Failed to download dataset manifest
"500":
description:Well it was bad-bad
"/data/{cid}/network/stream":
get:
summary:"Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able."
tags:[Data]
operationId:downloadNetworkStream
parameters:
- in:path
name:cid
required:true
schema:
$ref:"#/components/schemas/Cid"
description:"File to be downloaded."
responses:
"200":
description:Retrieved content specified by CID
content:
application/octet-stream:
schema:
type:string
format:binary
"400":
description:Invalid CID is specified
"404":
description:Content specified by the CID is not found
"500":
description:Well it was bad-bad
"/data/{cid}/network/manifest":
get:
summary:"Download only the dataset manifest from the network to the local node if it's not available locally."
tags:[Data]
operationId:downloadNetworkManifest
parameters:
- in:path
name:cid
required:true
schema:
$ref:"#/components/schemas/Cid"
description:"File for which the manifest is to be downloaded."
responses:
"200":
description:Manifest information.
content:
application/json:
schema:
$ref:"#/components/schemas/DataItem"
"400":
description:Invalid CID is specified
"404":
description:Failed to download dataset manifest
"500":
description:Well it was bad-bad
"/space":
get:
summary:"Gets a summary of the storage space allocation of the node."
tags:[Data]
operationId:space
responses:
"200":
description:"Summary of storage allocation"
content:
application/json:
schema:
$ref:"#/components/schemas/Space"
"500":
description:"It's not working as planned"
"/sales/slots":
get:
summary:"Returns active slots"
tags:[Marketplace]
operationId:getActiveSlots
responses:
"200":
description:Retrieved active slots
content:
application/json:
schema:
type:array
items:
$ref:"#/components/schemas/Slot"
"503":
description:Persistence is not enabled
"/sales/slots/{slotId}":
get:
summary:"Returns active slot with id {slotId} for the host"
tags:[Marketplace]
operationId:getActiveSlotById
parameters:
- in:path
name:slotId
required:true
schema:
$ref:"#/components/schemas/Cid"
description:File to be downloaded.
responses:
"200":
description:Retrieved active slot
content:
application/json:
schema:
$ref:"#/components/schemas/SlotAgent"
"400":
description:Invalid or missing SlotId
"404":
description:Host is not in an active sale for the slot
"503":
description:Persistence is not enabled
"/sales/availability":
get:
summary:"Returns storage that is for sale"
tags:[Marketplace]
operationId:getAvailabilities
responses:
"200":
description:Retrieved storage availabilities of the node