Logo

OBEDTECH CDN

API Overview

The OBEDTECH CDN API (v1.2.6) provides simple endpoints for uploading and deleting files with optional delete keys for secure file management. Files uploaded without a delete key cannot be deleted through the API unless you contact Owner.

Base URL

https://cdn.obedtech.name.ng

Endpoints

  • POST /api/upload.php
  • DELETE /api/delete.php

Uploading Files

Upload files to the CDN with optional delete key. If no delete key is provided, the file cannot be deleted through the API.

Request

Parameter Type Required Description
file File Yes The file to upload (multipart/form-data)
deleteKey String No Key required to delete the file later (if omitted, file cannot be deleted)

Response

{
  "name": "6Jexample_image.jpg",
  "path": "image/6Jexample_image.jpg",
  "url": "https://cdn.obedtech.name.ng/image/6Jexample_image.jpg",
  "size": "245KB",
  "mimetype": "image/jpeg",
  "storageClass": "Standard",
  "modified": "2023-05-18T12:34:56.789Z",
  "_id": "6465f3a7e4b0d4a9e4b0d4a9",
  "createdAt": "2023-05-18T12:34:56.789Z",
  "deleteKey": "your_delete_key_here" // Only if provided
}

Deleting Files

Delete files from the CDN. Requires the filename and the delete key that was provided during upload.

Request

Parameter Type Required Description
fileName String Yes The name of the file to delete
deleteKey String Yes The delete key provided during upload

Response

{
  "name": "6Jexample_image.jpg",
  "path": "image/6Jexample_image.jpg",
  "deleted": true,
  "_id": "6465f3a7e4b0d4a9e4b0d4a9",
  "deletedFromDb": true,
  "deletedFromServer": true
}

Code Examples

Upload Examples

const fs = require('fs');
const FormData = require('form-data');
const axios = require('axios');

const filePath = './example.jpg';
const deleteKey = 'your_secret_key'; // Optional

const form = new FormData();
form.append('file', fs.createReadStream(filePath));
if (deleteKey) form.append('deleteKey', deleteKey);

axios.post('https://cdn.obedtech.name.ng/api/upload.php', form, {
  headers: form.getHeaders()
})
.then(response => {
  console.log('Upload successful:', response.data);
})
.catch(error => {
  console.error('Upload failed:', error.response?.data || error.message);
});
import requests

url = 'https://cdn.obedtech.name.ng/api/upload.php'
file_path = 'example.jpg'
delete_key = 'your_secret_key'  # Optional

with open(file_path, 'rb') as f:
    files = {'file': f}
    data = {'deleteKey': delete_key} if delete_key else {}
    response = requests.post(url, files=files, data=data)

if response.status_code == 200:
    print('Upload successful:', response.json())
else:
    print('Upload failed:', response.text)
 new CURLFile($file_path),
];
if (!empty($delete_key)) {
    $post_fields['deleteKey'] = $delete_key;
}

curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code == 200) {
    echo 'Upload successful: ' . $response;
} else {
    echo 'Upload failed: ' . $response;
}
?>
curl -X POST https://cdn.obedtech.name.ng/api/upload.php \
  -F "file=@example.jpg" \
  -F "deleteKey=your_secret_key"  # Optional

Delete Examples

const axios = require('axios');

const fileName = '6Jexample_image.jpg';
const deleteKey = 'your_secret_key';

axios.delete('https://cdn.obedtech.name.ng/api/delete.php', {
  data: { fileName, deleteKey }
})
.then(response => {
  console.log('Delete successful:', response.data);
})
.catch(error => {
  console.error('Delete failed:', error.response?.data || error.message);
});
import requests

url = 'https://cdn.obedtech.name.ng/api/delete.php'
data = {
    'fileName': '6Jexample_image.jpg',
    'deleteKey': 'your_secret_key'
}

response = requests.delete(url, json=data)

if response.status_code == 200:
    print('Delete successful:', response.json())
else:
    print('Delete failed:', response.text)
 '6Jexample_image.jpg',
    'deleteKey' => 'your_secret_key'
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code == 200) {
    echo 'Delete successful: ' . $response;
} else {
    echo 'Delete failed: ' . $response;
}
?>
curl -X DELETE https://cdn.obedtech.name.ng/api/delete.php \
  -H "Content-Type: application/json" \
  -d '{"fileName": "6Jexample_image.jpg", "deleteKey": "your_secret_key"}'