Harmon Files API Documentation

APIs for file upload and authentication management for sCloud.

upload.php

Authenticated endpoint for uploading files to sCloud and recording upload history.

POST /upload.php

Request Parameters

Name Type Required Description
filefileYes*The file to upload (either file or url required).
urlstringYes*URL to download and upload (either file or url required).
authCodestringYesAuthentication code (32 characters).
upload_typestringNoType of upload (default: "file", "url" for URL uploads).
folder_namestringNoName of the folder for the upload.
relative_pathstringNoRelative path of the file.

Responses

Success (code: 0):
{
    "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"
    }
}
                

Authentication

The authCode parameter must be a valid 32-character code. The code must exist as a JSON file in the histories/ directory.

Upload History

Each successful upload is recorded in the user's history file (histories/{authCode}.json), including metadata such as file name, size, and upload time.

Example Requests


# 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())
                    

auth.php

API for authentication code management: generation, validation, deletion.

POST /auth.php GET /auth.php

Actions

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.

Example Requests


# 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())
                    

Response Example

{
    "success": true,
    "data": {
        "authCode": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    }
}