Skip to content

Latest commit

 

History

History
408 lines (298 loc) · 9.35 KB

File metadata and controls

408 lines (298 loc) · 9.35 KB
title language_tabs language_clients toc_footers includes search highlight_theme headingLevel
Distributor node public API v0.1.0
javascript
JavaScript
shell
Shell
javascript
shell
true
darkula
2

Distributor node public API v0.1.0

Scroll down for code samples, example requests and responses.

Distributor node public API

Base URLs:

Email: Support License: GPL-3.0-only

Default

public.status

Code samples

const headers = {
  'Accept':'application/json'
};

fetch('http://localhost:3334/api/v1/status',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
# You can also use wget
curl -X GET http://localhost:3334/api/v1/status \
  -H 'Accept: application/json'

GET /status

Returns json object describing current node status.

Example responses

200 Response

{
  "id": "string",
  "version": "string",
  "workerId": 0,
  "objectsInCache": 0,
  "storageLimit": 0,
  "storageUsed": 0,
  "uptime": 0,
  "downloadsInProgress": 0,
  "nodeEnv": "string",
  "queryNodeStatus": {
    "url": "string",
    "chainHead": 0,
    "blocksProcessed": 0,
    "packageVersion": "string"
  }
}

Responses

Status Meaning Description Schema
200 OK OK StatusResponse
500 Internal Server Error Unexpected server error None
This operation does not require authentication

public.buckets

Code samples

const headers = {
  'Accept':'application/json'
};

fetch('http://localhost:3334/api/v1/buckets',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
# You can also use wget
curl -X GET http://localhost:3334/api/v1/buckets \
  -H 'Accept: application/json'

GET /buckets

Returns list of distributed buckets

Example responses

200 Response

{
  "bucketIds": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK OK BucketsResponse
500 Internal Server Error Unexpected server error None
This operation does not require authentication

public.assetHead

Code samples

fetch('http://localhost:3334/api/v1/assets/{objectId}',
{
  method: 'HEAD'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
# You can also use wget
curl -X HEAD http://localhost:3334/api/v1/assets/{objectId}

HEAD /assets/{objectId}

Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)

Parameters

Name In Type Required Description
objectId path string true Data Object ID

Responses

Status Meaning Description Schema
200 OK Object is supported and should be send on GET request. None
404 Not Found Data object does not exist or has not been uploaded yet. None
421 Misdirected request Misdirected request. Data object not supported by the node. None
500 Internal Server Error Unexpected server error None

Response Headers

Status Header Type Format Description
200 X-Cache string Describes cache status of an object. Hit - object is already fully fetched in distributor node's cache. Pending - object is still beeing fetched from the storage node. Miss - object is neither in cache not currently beeing fetched. Fetching from storage node may be triggered.
This operation does not require authentication

public.asset

Code samples

const headers = {
  'Accept':'image/*'
};

fetch('http://localhost:3334/api/v1/assets/{objectId}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
# You can also use wget
curl -X GET http://localhost:3334/api/v1/assets/{objectId} \
  -H 'Accept: image/*'

GET /assets/{objectId}

Returns a media file.

Parameters

Name In Type Required Description
objectId path string true Data Object ID

Example responses

200 Response

404 Response

{
  "type": "string",
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK Full available object data sent string
206 Partial Content Requested partial object data sent string
404 Not Found Data object does not exist or has not been uploaded yet. ErrorResponse
421 Misdirected request Misdirected request. Data object not supported. ErrorResponse
500 Internal Server Error Unexpected server error None

Response Headers

Status Header Type Format Description
200 X-Cache string Describes cache status of an object. Hit - object is already fully fetched in distributor node's cache. Pending - object is still beeing fetched from the storage node. Miss - object is neither in cache not currently beeing fetched. Fetching from storage node may be triggered.
200 X-Data-Source string Describes the source of data stream. External - the request was proxied to a storage node. Local - the data is streamed from local file.
206 X-Cache string Describes cache status of an object. Hit - object is already fully fetched in distributor node's cache. Pending - object is still beeing fetched from the storage node. Miss - object is neither in cache not currently beeing fetched. Fetching from storage node may be triggered.
206 X-Data-Source string Describes the source of data stream. External - the request was proxied to a storage node. Local - the data is streamed from local file.
This operation does not require authentication

Schemas

ErrorResponse

{
  "type": "string",
  "message": "string"
}

Properties

Name Type Required Restrictions Description
type string false none none
message string true none none

StatusResponse

{
  "id": "string",
  "version": "string",
  "workerId": 0,
  "objectsInCache": 0,
  "storageLimit": 0,
  "storageUsed": 0,
  "uptime": 0,
  "downloadsInProgress": 0,
  "nodeEnv": "string",
  "queryNodeStatus": {
    "url": "string",
    "chainHead": 0,
    "blocksProcessed": 0,
    "packageVersion": "string"
  }
}

Properties

Name Type Required Restrictions Description
id string true none none
version string true none none
workerId integer false none none
objectsInCache integer true none none
storageLimit integer true none none
storageUsed integer true none none
uptime integer true none none
downloadsInProgress integer true none none
nodeEnv string true none none
queryNodeStatus object true none none
» url string true none none
» chainHead integer true none none
» blocksProcessed integer true none none
» packageVersion string true none none

BucketsResponse

{
  "bucketIds": [
    "string"
  ]
}

Properties

oneOf

Name Type Required Restrictions Description
anonymous object false none none
» bucketIds [string] true none none

xor

Name Type Required Restrictions Description
anonymous object false none none
» allByWorkerId integer true none none

undefined