Roe Datasets
Download File
Download a file or specific page range from a file.
GET
/
v1
/
datasets
/
files
/
{id}
/
download
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string fileId = "YOUR_FILE_ID"; // Replace with your file ID
string token = "YOUR_API_TOKEN"; // Replace with your API token
string outputPath = "downloaded_file.pdf"; // Path where to save the downloaded file
string url = $"https://api.roe-ai.com/v1/datasets/files/{fileId}/download/";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// Send the request
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
// For binary files, save the content to a file
byte[] fileBytes = await response.Content.ReadAsByteArrayAsync();
File.WriteAllBytes(outputPath, fileBytes);
Console.WriteLine($"File downloaded successfully to {outputPath}");
// If you want to read as text instead (for text files)
// string responseBody = await response.Content.ReadAsStringAsync();
// Console.WriteLine(responseBody);
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
string errorContent = await response.Content.ReadAsStringAsync();
Console.WriteLine(errorContent);
}
}
}
This response does not have an example.
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
ID of the file to download.
Query Parameters
(Optional) Page range for file (e.g., "1-3,5,7-9"). If not provided, the entire file will be downloaded.
Response
200
_mintlify/placeholder
File content
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string fileId = "YOUR_FILE_ID"; // Replace with your file ID
string token = "YOUR_API_TOKEN"; // Replace with your API token
string outputPath = "downloaded_file.pdf"; // Path where to save the downloaded file
string url = $"https://api.roe-ai.com/v1/datasets/files/{fileId}/download/";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// Send the request
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
// For binary files, save the content to a file
byte[] fileBytes = await response.Content.ReadAsByteArrayAsync();
File.WriteAllBytes(outputPath, fileBytes);
Console.WriteLine($"File downloaded successfully to {outputPath}");
// If you want to read as text instead (for text files)
// string responseBody = await response.Content.ReadAsStringAsync();
// Console.WriteLine(responseBody);
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
string errorContent = await response.Content.ReadAsStringAsync();
Console.WriteLine(errorContent);
}
}
}
This response does not have an example.