Skip to main content

File API

POST /file

Description

This API endpoint retrieves details of a specific file by its ID.

Request Body

The request uses GraphQL to perform the file query, which requires the id of the file as a parameter.

Query:

query file ($id: Int) {
file (id: $id) {
id
title
description
url
}
}

GraphQL Variables:

{
"id": 0
}

Example Request:

curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query file ($id: Int) {\n file (id: $id) {\n id\n title\n description\n url\n }\n}","variables":{"id":0}}'

Response:

  • Success (200 OK):

    • The response includes details of the file with the specified ID.
    {
    "data": {
    "file": {
    "id": 1,
    "title": "User Guide",
    "description": "Comprehensive guide for users.",
    "url": "https://example.com/files/user-guide.pdf"
    }
    }
    }
    • id: Unique identifier for the file.
    • title: Title of the file.
    • description: Description of the file.
    • url: URL to access or download the file.
  • Error (4XX/5XX):

    • If the file is not found or if there is a server error, the response will include an error message and status code.

Note:

To use this endpoint, you need to provide the id of the file you wish to retrieve. The response will provide detailed information about that specific file, including its URL for access or download.