fetch
Published: March 2025 | Last updated: March 2025
fetch
Overview
The fetch
RPC method allows you to retrieve files that have been stored on the Lynx blockchain. It provides a mechanism for accessing data by its unique identifier (UUID) and saving it to a specified location on your filesystem. No authentication is required prior to using this function.
Syntax
Description
When you invoke the fetch
method, the Lynx daemon searches the blockchain for the specified file and downloads it to your designated location. This method is part of the core functionality that enables Lynx to serve as a decentralized data storage solution.
Parameters
uuid
string
Yes
The unique identifier of the file you want to retrieve. This is a 64-character hexadecimal string (e.g., 2cf6eabc7af83152d5ad7d4ff9aeeb66f81dde70731b800bb0cd18300d9cb402).
path
string
Yes
The full filesystem path where the retrieved file should be stored (e.g., /home/username/downloads
). This path must exist before calling the method.
pubkeyflag
string
No
Optional parameter that controls tenant public key inclusion in the response. Enter 0
to omit the tenant information. Default is 1
(include tenant information).
Returns
The method returns an array containing a single object with the following fields:
result
string
Indicates whether the operation succeeded (success
) or failed (failure
).
message
string
Provides additional information about the result. For successful operations, returns n/a
. For failures, indicates the reason (e.g., Invalid path /path/to/directory.
, Invalid UUID length.
, UUID not found.
).
tenant
string/number
When authentication is active and pubkeyflag
is set to 1
, displays the tenant public key associated with the file. Otherwise returns n/a
.
Examples
Retrieve a specific file
Retrieve the file with UUID 2cf6eabc7af83152d5ad7d4ff9aeeb66f81dde70731b800bb0cd18300d9cb402 and store it in the /home/username/downloads
directory:
Or using JSON-RPC:
Retrieve a file without tenant verification
This method is significantly faster. Retrieve a file without performing tenant verification:
Error Handling
The method will return a failure result in the following scenarios:
The specified path doesn't exist on the filesystem
The UUID has an invalid length (must be 64 characters for a specific file)
Last updated