APIs for file upload and authentication management for sCloud.
Authenticated endpoint for uploading files to sCloud and recording upload history.
Name | Type | Required | Description |
---|---|---|---|
file | file | Yes* | The file to upload (either file or url required). |
url | string | Yes* | URL to download and upload (either file or url required). |
authCode | string | Yes | Authentication code (32 characters). |
upload_type | string | No | Type of upload (default: "file", "url" for URL uploads). |
folder_name | string | No | Name of the folder for the upload. |
relative_path | string | No | Relative path of the file. |
{ "code": 0, "msg": "success", "data": { "directFileUrl": "https://harmon.com.tr/download.php?file=...", "fileName": "...", "originalName": "..." } }Error (code: 1):
{ "code": 1, "msg": "error", "data": { "error": "Error message" } }
The authCode
parameter must be a valid 32-character code. The code must exist as a JSON file in the histories/
directory.
Each successful upload is recorded in the user's history file (histories/{authCode}.json
), including metadata such as file name, size, and upload time.
# Upload file
curl -X POST -F "file=@yourfile.txt" -F "authCode=YOUR_AUTH_CODE" https://harmon.com.tr/upload.php
# Upload from URL
curl -X POST -F "url=https://example.com/file.pdf" -F "authCode=YOUR_AUTH_CODE" https://harmon.com.tr/upload.php
const FormData = require('form-data');
const fs = require('fs');
const fetch = require('node-fetch');
// Upload file
const form = new FormData();
form.append('file', fs.createReadStream('yourfile.txt'));
form.append('authCode', 'YOUR_AUTH_CODE');
fetch('https://harmon.com.tr/upload.php', {
method: 'POST',
body: form
})
.then(res => res.json())
.then(console.log);
// Upload from URL
const urlForm = new FormData();
urlForm.append('url', 'https://example.com/file.pdf');
urlForm.append('authCode', 'YOUR_AUTH_CODE');
fetch('https://harmon.com.tr/upload.php', {
method: 'POST',
body: urlForm
})
.then(res => res.json())
.then(console.log);
import requests
# Upload file
files = {'file': open('yourfile.txt', 'rb')}
data = {'authCode': 'YOUR_AUTH_CODE'}
response = requests.post('https://harmon.com.tr/upload.php', files=files, data=data)
print(response.json())
# Upload from URL
url_data = {
'url': 'https://example.com/file.pdf',
'authCode': 'YOUR_AUTH_CODE'
}
response = requests.post('https://harmon.com.tr/upload.php', data=url_data)
print(response.json())
API for authentication code management: generation, validation, deletion.
Action | Method | Description |
---|---|---|
generate | POST | Generate a new authentication code. |
validate | POST/GET | Validate an authentication code. |
login | POST | Login with an authentication code. |
regenerate | POST | Regenerate (delete and create) an authentication code. |
delete | POST | Delete an authentication code. |
# Generate auth code
curl -X POST -H "Content-Type: application/json" -d '{"action":"generate"}' https://harmon.com.tr/auth.php
# Validate auth code
curl -X POST -H "Content-Type: application/json" -d '{"action":"validate","authCode":"YOUR_AUTH_CODE"}' https://harmon.com.tr/auth.php
const fetch = require('node-fetch');
// Generate auth code
fetch('https://harmon.com.tr/auth.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'generate' })
})
.then(res => res.json())
.then(console.log);
// Validate auth code
fetch('https://harmon.com.tr/auth.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'validate', authCode: 'YOUR_AUTH_CODE' })
})
.then(res => res.json())
.then(console.log);
import requests
# Generate auth code
response = requests.post('https://harmon.com.tr/auth.php', json={'action': 'generate'})
print(response.json())
# Validate auth code
response = requests.post('https://harmon.com.tr/auth.php', json={'action': 'validate', 'authCode': 'YOUR_AUTH_CODE'})
print(response.json())
{ "success": true, "data": { "authCode": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } }