파일

Get details about a file

GET//localhost:9090/api/file/{id}
Path parameters
id*integer

File ID

Response

OK

Body
attachmentIdinteger

Associations

cidstring

CID is the CID of the file.

directoryIdinteger
fileRangesarray of model.FileRange (object)
hashstring

Hash is the hash of the file.

idinteger
lastModifiedNanointeger
pathstring

Path is the relative path to the file inside the storage.

sizeinteger

Size is the size of the file in bytes.

Request
const response = await fetch('//localhost:9090/api/file/{id}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "attachmentId": 0,
  "cid": "text",
  "directoryId": 0,
  "fileRanges": [
    {
      "cid": "text",
      "fileId": 0,
      "id": 0,
      "jobId": 0,
      "length": 0,
      "offset": 0
    }
  ],
  "hash": "text",
  "id": 0,
  "lastModifiedNano": 0,
  "path": "text",
  "size": 0
}

Get all deals that have been made for a file

GET//localhost:9090/api/file/{id}/deals
Path parameters
id*integer

File ID

Response

OK

Body
dealsarray of model.Deal (object)
fileRangemodel.FileRange (object)
Request
const response = await fetch('//localhost:9090/api/file/{id}/deals', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
[
  {
    "deals": [
      {
        "clientId": "text",
        "createdAt": "text",
        "dealId": 0,
        "endEpoch": 0,
        "errorMessage": "text",
        "id": 0,
        "label": "text",
        "lastVerifiedAt": "text",
        "pieceCid": "text",
        "pieceSize": 0,
        "price": "text",
        "proposalId": "text",
        "provider": "text",
        "scheduleId": 0,
        "sectorStartEpoch": 0,
        "startEpoch": 0,
        "state": "proposed",
        "updatedAt": "text",
        "verified": false
      }
    ],
    "fileRange": {
      "cid": "text",
      "fileId": 0,
      "id": 0,
      "jobId": 0,
      "length": 0,
      "offset": 0
    }
  }
]

prepare job for a given item

POST//localhost:9090/api/file/{id}/prepare_to_pack
Path parameters
id*integer

File ID

Response

OK

Body
integer
Request
const response = await fetch('//localhost:9090/api/file/{id}/prepare_to_pack', {
    method: 'POST',
    headers: {},
});
const data = await response.json();
Response
0

Push a file to be queued

Tells Singularity that something is ready to be grabbed for data preparation

POST//localhost:9090/api/preparation/{id}/source/{name}/file
Path parameters
id*string

Preparation ID or name

name*string

Source storage ID or name

Body

File Info

pathstring

Path to the new file, relative to the source

Response

OK

Body
attachmentIdinteger

Associations

cidstring

CID is the CID of the file.

directoryIdinteger
fileRangesarray of model.FileRange (object)
hashstring

Hash is the hash of the file.

idinteger
lastModifiedNanointeger
pathstring

Path is the relative path to the file inside the storage.

sizeinteger

Size is the size of the file in bytes.

Request
const response = await fetch('//localhost:9090/api/preparation/{id}/source/{name}/file', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "attachmentId": 0,
  "cid": "text",
  "directoryId": 0,
  "fileRanges": [
    {
      "cid": "text",
      "fileId": 0,
      "id": 0,
      "jobId": 0,
      "length": 0,
      "offset": 0
    }
  ],
  "hash": "text",
  "id": 0,
  "lastModifiedNano": 0,
  "path": "text",
  "size": 0
}

Last updated