index.md 8.6 KB


title: Distributor node public API v0.1.0 language_tabs:

  • javascript: JavaScript
  • shell: Shell language_clients:
  • javascript: ""
  • shell: "" toc_footers:
  • Distributor node public API includes: [] search: true highlight_theme: darkula headingLevel: 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",
  "objectsInCache": 0,
  "storageLimit": 0,
  "storageUsed": 0,
  "uptime": 0,
  "downloadsInProgress": 0
}

Responses

Status Meaning Description Schema
200 OK OK StatusResponse
500 Internal Server Error Unexpected server error None

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

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. 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.

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. 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.

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",
  "objectsInCache": 0,
  "storageLimit": 0,
  "storageUsed": 0,
  "uptime": 0,
  "downloadsInProgress": 0
}

Properties

Name Type Required Restrictions Description
id string true 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

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