Example Code
PHP Example - v1/store
<?php
$apiUrl = 'https://api.xfile.pw/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,
];
$options = [
'http' => [
'header' => "Content-type: application/json\r\n" .
"xFile: Bearer $apiKey",
'method' => 'POST',
'content' => json_encode($data),
],
];
$context = stream_context_create($options);
$response = file_get_contents($apiUrl, false, $context);
if ($response === false) {
die('Error occurred while making the request.');
}
$result = json_decode($response, true);
var_dump($result);
?>
Node.js Example - v1/store
const fetch = require('node-fetch');
const apiUrl = 'https://api.xfile.pw/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.pw/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.pw/v1/info';
$fileIdInfo = '2ytqRDuFL2'; // Replace with the actual file ID
$apiKeyInfo = 'YOUR_API_KEY'; // Replace with your actual API key
$optionsInfo = [
'http' => [
'header' => "Content-type: application/json\r\n" .
"xFile: Bearer $apiKeyInfo",
'method' => 'GET',
],
];
$contextInfo = stream_context_create($optionsInfo);
$responseInfo = file_get_contents($apiUrlInfo . "?file_id=$fileIdInfo", false, $contextInfo);
if ($responseInfo === false) {
die('Error occurred while making the request.');
}
$resultInfo = json_decode($responseInfo, true);
var_dump($resultInfo);
?>
Node.js Example - v1/info
const fetch = require('node-fetch');
const apiUrlInfo = 'https://api.xfile.pw/v1/info';
const fileIdInfo = '2ytqRDuFL2'; // 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.pw/v1/info'
file_id_info = '2ytqRDuFL2' # 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.')