Example Code

PHP CLASS FILE : DOWNLOAD HERE

PHP Example - v1/store


<?php
$apiUrl = 'https://api.xfile.sbs/v1/store';

$fileId = '1z6ogb3nQpg4-E32CdKkXKC8vnzJcG8WH'; // Replace with the actual Google Drive file ID
$apiKey = 'YOUR_API_KEY'; // Replace with your actual API key

$data = [
    'file_id' => $fileId,
];

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "xFile: Bearer $apiKey",
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

// Execute cURL request
$response = curl_exec($ch);

// Check for cURL errors
if (curl_errno($ch)) {
    die('cURL error: ' . curl_error($ch));
}

// Close cURL session
curl_close($ch);

// Decode JSON response
$result = json_decode($response, true);

// Output the result
var_dump($result);
?>

    

Node.js Example - v1/store


const fetch = require('node-fetch');

const apiUrl = 'https://api.xfile.sbs/v1/store';
const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key

const fileId = '1z6ogb3nQpg4-E32CdKkXKC8vnzJcG8WH'; // Replace with the actual Google Drive file ID

fetch(apiUrl, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'xFile': `Bearer ${apiKey}`,
    },
    body: JSON.stringify({
        file_id: fileId,
    }),
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error('Error occurred while making the request:', error));
    

Python Example - v1/store


import requests

api_url = 'https://api.xfile.sbs/v1/store'
api_key = 'YOUR_API_KEY'  # Replace with your actual API key

file_id = '1z6ogb3nQpg4-E32CdKkXKC8vnzJcG8WH'  # Replace with the actual Google Drive file ID

headers = {
    'Content-Type': 'application/json',
    'xFile': f'Bearer {api_key}',
}

data = {
    'file_id': file_id,
}

response = requests.post(api_url, json=data, headers=headers)

if response.status == 200:
    result = response.json()
    print(result)
else:
    print('Error occurred while making the request.')
    

PHP Example - v1/info


<?php
$apiUrlInfo = 'https://api.xfile.sbs/v1/info';
$fileIdInfo = '2ytqRDumN5'; // Replace with the actual file ID
$apiKeyInfo = 'YOUR_API_KEY'; // Replace with your actual API key

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $apiUrlInfo . "?file_id=$fileIdInfo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "xFile: Bearer $apiKeyInfo",
]);

// Execute cURL request
$responseInfo = curl_exec($ch);

// Check for cURL errors
if (curl_errno($ch)) {
    die('cURL error: ' . curl_error($ch));
}

// Close cURL session
curl_close($ch);

// Decode JSON response
$resultInfo = json_decode($responseInfo, true);

// Output the result
var_dump($resultInfo);
?>

    

Node.js Example - v1/info


const fetch = require('node-fetch');

const apiUrlInfo = 'https://api.xfile.sbs/v1/info';
const fileIdInfo = '2ytqRDumN5'; // Replace with the actual file ID
const apiKeyInfo = 'YOUR_API_KEY'; // Replace with your actual API key

fetch(`${apiUrlInfo}?file_id=${fileIdInfo}`, {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json',
        'xFile': `Bearer ${apiKeyInfo}`,
    },
})
.then(responseInfo => responseInfo.json())
.then(resultInfo => console.log(resultInfo))
.catch(errorInfo => console.error('Error occurred while making the request:', errorInfo));
    

Python Example - v1/info


import requests

api_url_info = 'https://api.xfile.sbs/v1/info'
file_id_info = '2ytqRDumN5'  # Replace with the actual file ID
api_key_info = 'YOUR_API_KEY'  # Replace with your actual API key

headers_info = {
    'Content-Type': 'application/json',
    'xFile': f'Bearer {api_key_info}',
}

response_info = requests.get(f'{api_url_info}?file_id={file_id_info}', headers=headers_info)

if response_info.status == 200:
    result_info = response_info.json()
    print(result_info)
else:
    print('Error occurred while making the request.')