📃Retrieve File Information

Endpoint to retrieve information about a specific file based on its UID.

  • HTTP Method: GET

  • Route: /public-api/v1/files/:uid

  • Headers:

    • api-key: Token generated through the API key section.

Query Parameters

  • uid: The unique identifier (UID) of the file to retrieve.

Response

  • Status Code: 200 OK

  • Response Body:

    {
      "ID": 1,
      "Name": "example.txt",
      "UID": "unique_id",
      "Root": "/",
      "CID": "QmXqwe12...",
      "Mime": "text/plain",
      "Size": 1024,
      "EncryptionStatus": "public",
      "CreatedAt": "2023-01-01T12:00:00Z",
      "UpdatedAt": "2023-01-01T12:00:00Z"
    }

Error Responses

  • Entity Not Found (404): If the file with the specified UID does not exist.

Example in JavaScript:

Using Fetch API:

const url = 'base_url/public-api/v1/files/your_file_uid';
const apiKey = 'your_api_key';

fetch(url, {
  method: 'GET',
  headers: {
    'api-key': apiKey,
  },
})
  .then((response) => {
    if (!response.ok) {
      if (response.status === 404) {
        console.error('File not found.');
      } else {
        throw new Error(`Network error: ${response.status}`);
      }
    }
    return response.json();
  })
  .then((data) => {
    console.log(data);
  })
  .catch((error) => {
    console.error('There was a problem with the Fetch request:', error);
  });

Using Axios:

const axios = require('axios');

const url = 'base_url/public-api/v1/files/your_file_uid';
const apiKey = 'your_api_key';

axios.get(url, {
  headers: {
    'api-key': apiKey,
  },
})
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    if (error.response.status === 404) {
      console.error('File not found.');
    } else {
      console.error('There was a problem with the Axios request:', error);
    }
  });

Last updated