s3.php¶
S3 storage management module: creating and deleting accounts, managing buckets and files, retrieving usage statistics, managing billing plans and billing.
API Methods¶
| Method | Action | Description |
|---|---|---|
create_account | S3 account creation | Creates a new S3 account for a client, links a billing plan, creates a bucket, and places an order in billing. |
create_bucket | S3 bucket creation | Creates a new bucket with the specified name for an existing client S3 account. |
create_order | S3 account order creation | Creates a new order for an S3 account based on the specified billing plan, validates the bucket name, checks limits and credits, and creates a user and service in billing. |
delete_account | S3 account deletion | Completely deletes a user's S3 account, including all associated buckets and data. |
delete_bucket | S3 bucket deletion | Deletes the specified bucket from the client's S3 account after checking access rights and ownership. |
delete_file | file deletion | Deletes the specified file from the user's S3 bucket. |
delete_payment_account | cancellation of paid S3 account | Initiates the process of canceling a paid S3 account, setting the cancellation date in the billing system. |
get_buckets | bucket list retrieval | Returns a list of S3 buckets for the specified user, including information on storage usage, bandwidth, snapshots, and access keys. |
get_buckets_rmq | bucket list retrieval via message queue | Returns a list of S3 buckets for the specified user, including information on storage usage, bandwidth, snapshots, and access credentials. |
get_files | file list retrieval | Returns a list of files and folders in the specified S3 bucket with pagination and search support. |
get_users | S3 user list retrieval | Returns a list of S3 accounts with information about the service, traffic, and storage usage. Supports filtering and pagination for administrators. |
history | change history retrieval | Returns the change history for the specified S3 plan or account by ID. |
list_plans | S3 billing plan list retrieval | Returns a list of available S3 billing plans. Hides inactive plans for clients (if no s3_test tag), for administrators it can return a specific plan by ID. |
show_key | access key retrieval | Returns the decrypted access key (access_key or secret_key) for the specified S3 account. |
s3/cancel_payment_account_deletion¶
Cancels the scheduled deletion of a paid S3 account, restoring its status and expiration date.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: cancel_payment_account_deletion |
| token | ✅ | string | Authorization token for access rights verification |
| s3uid | ✅ | string | Unique identifier of the S3 account for which deletion is being canceled |
| id | ❌ | int | Client ID (used by administrators to manage other users' accounts) |
Example Request
Example of a successful response
s3/create_account¶
Creates a new S3 account for a client, links a billing plan, creates a bucket, and places an order in billing.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: create_account |
| token | ✅ | string | User authorization token |
| plan_id | ✅ | int | S3 billing plan identifier |
| bucket_name | ✅ | string | Name of the bucket to be created |
| location | ❌ | string | Storage location (default NL) |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "s3/create_order: missing auth token" }
```
s3/create_bucket¶
Creates a new bucket with the specified name for an existing client S3 account.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: create_bucket |
| token | ✅ | string | User authorization token |
| s3uid | ✅ | string | Unique identifier of the user's S3 account |
| bucket_name | ✅ | string | Name of the bucket to be created (must be unique and comply with validation rules) |
Example Request
Example of a successful response
s3/create_order¶
Creates a new order for an S3 account based on the specified billing plan, validates the bucket name, checks limits and credits, and creates a user and service in billing.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: create_order |
| token | ✅ | string | User authorization token |
| plan_id | ✅ | int | S3 billing plan ID |
| bucket_name | ✅ | string | Name of the bucket to be created (must be valid) |
| location | ✅ | string | Location code (e.g., NL, DE, US) |
Example Request
Example of a successful response
s3/delete_account¶
Completely deletes a user's S3 account, including all associated buckets and data.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: delete_account |
| token | ✅ | string | Authorization token for access rights verification |
| id | ❌ | int | Client ID (for administrators, if deleting another user's account is required) |
| s3uid | ✅ | string | Unique identifier of the S3 user (s3uid) to be deleted |
Example Request
s3/delete_bucket¶
Deletes the specified bucket from the client's S3 account after checking access rights and ownership.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: delete_bucket |
| token | ✅ | string | User authorization token |
| id | ❌ | int | Client ID (for administrators) |
| s3uid | ✅ | string | Unique identifier of the user's S3 account |
| bucket_name | ✅ | string | Name of the bucket to be deleted |
Example Request
Example of a successful response
s3/delete_file¶
Deletes the specified file from the user's S3 bucket.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: delete_file |
| token | ✅ | string | Authorization token |
| s3uid | ✅ | string | Unique identifier of the user's S3 account |
| bucket_name | ✅ | string | Name of the bucket from which the file is being deleted |
| filename | ✅ | string | Full file name (key) to be deleted |
Example Request
Example of a successful response
Failure response
s3/delete_payment_account¶
Initiates the process of canceling a paid S3 account, setting the cancellation date in the billing system.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: delete_payment_account |
| token | ✅ | string | User authorization token |
| s3uid | ✅ | string | Unique identifier of the S3 account to be canceled |
Example Request
Example of a successful response
s3/get_buckets¶
Returns a list of S3 buckets for the specified user, including information on storage usage, bandwidth, snapshots, and access keys.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_buckets |
| token | ✅ | string | User authorization token |
| s3uid | ✅ | string | Unique identifier of the S3 user |
| id | ❌ | integer | Client ID (for administrators) |
Example Request
Example of a successful response
{
"result": "OK",
"action": "get_buckets",
"message": [
{
"name": "my-bucket-01",
"usage": 1073741824,
"created_at": "2024-01-15T10:30:00Z"
},
{
"name": "backup-data",
"usage": 5368709120,
"created_at": "2024-02-20T14:45:00Z"
}
],
"bandwidth": 1048576,
"usage_storage": 6442450944,
"quota": 5000000000000,
"snapshots": [
{
"bandwidth_usage": 1048576,
"storage_usage": 6442450944,
"created_at": "2024-05-20 12:00:00"
}
],
"access_key": "4KCTQIAZ1GLPB8TFIMTO",
"secret_key": "5wsy0Sd1nYyyACKWYQPhVqbX36t2gDjdVsnv7n8D",
"endpoint": "https://s3.nl.hostkey.com"
}
s3/get_buckets_rmq¶
Returns a list of S3 buckets for the specified user, including information on storage usage, bandwidth, snapshots, and access credentials.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_buckets_rmq |
| token | ✅ | string | Authorization token for access rights verification |
| s3uid | ✅ | string | Unique identifier of the S3 user (S3UID) |
| id | ❌ | integer | Client identifier (used by administrators to view other accounts) |
Example Request
Example of a successful response
{
"result": "OK",
"action": "get_buckets_rmq",
"message": [
{
"name": "my-bucket-01",
"usage": 1073741824,
"count": 150,
"created": "2023-10-15T10:30:00Z"
},
{
"name": "backup-data",
"usage": 5368709120,
"count": 42,
"created": "2023-11-20T14:45:00Z"
}
],
"bandwidth": 1048576,
"usage_storage": 6442450944,
"quota": 107374182400,
"snapshots": [
{
"bandwidth_usage": 1048576,
"storage_usage": 6442450944,
"created_at": "2024-01-15 12:00:00"
}
],
"access_key": "4KCTQIAZ1GLPB8TFIMTO",
"secret_key": "5wsy0Sd1nYyyACKWYQPhVqbX36t2gDjdVsnv7n8D",
"endpoint": "https://s3.nl.hostkey.com"
}
s3/get_files¶
Returns a list of files and folders in the specified S3 bucket with pagination and search support.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_files |
| token | ✅ | string | Authorization token |
| s3uid | ✅ | string | Unique identifier of the S3 user |
| bucket_name | ✅ | string | S3 bucket name |
| continuation_token | ❌ | string | Token for continuing pagination (if any) |
| max_keys | ❌ | int | Maximum number of files to return (default 50, maximum 100) |
| search | ❌ | string | String to search for in file names |
Example Request
Example of a successful response
{
"result": "OK",
"action": "get_files",
"files": [
{
"key": "folder/subfolder/file.txt",
"original_key": "folder/subfolder/file.txt",
"size": 1024,
"last_modified": "2024-01-15T10:30:00Z",
"etag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
"storage_class": "STANDARD"
},
{
"key": "image.png",
"original_key": "image.png",
"size": 2048576,
"last_modified": "2024-01-14T08:20:00Z",
"etag": "\"e99a18c428cb38d5f260853678922e03\"",
"storage_class": "STANDARD"
}
],
"folders": [
{
"key": "folder/",
"size": 0,
"last_modified": "2024-01-15T10:30:00Z"
},
{
"key": "folder/subfolder/",
"size": 0,
"last_modified": "2024-01-15T10:30:00Z"
}
],
"next_token": "eyJDb250aW51YXRpb25Ub2tlbiI6IkZhbHNlIiwiQ29udGVudCI6eyJrZXkiOiJmb2xkZXIvc3ViZm9sZGVyL2ZpbGUudHh0In19"
}
s3/get_users¶
Returns a list of S3 accounts with information about the service, traffic, and storage usage. Supports filtering and pagination for administrators.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_users |
| token | ✅ | string | Authorization token |
| id | ❌ | int | Client ID (for administrator) or S3 account ID |
| plan_id | ❌ | int | S3 billing plan ID |
| s3uid | ❌ | string | Unique identifier of the S3 user |
| ❌ | string | User email for filtering | |
| billing | ❌ | string | Billing system for filtering |
| bucket_name | ❌ | string | Bucket name to search for a user |
| storage_type | ❌ | string | Storage type (Standard, Cold, etc.) |
| location | ❌ | string | Location (region code, e.g., NL) |
| period_from | ❌ | string | Start date of the period for traffic statistics (YYYY-MM-DD) |
| period_to | ❌ | string | End date of the period for traffic statistics (YYYY-MM-DD) |
| order | ❌ | string | Field for sorting (total_traffic_period_gb, total_storage_peak_gb) |
| order_by | ❌ | string | Sorting direction (ASC, DESC) |
| limit | ❌ | int | Number of records to return |
| offset | ❌ | int | Offset for pagination |
Example Request
Example of a successful response
{
"result": "OK",
"action": "get_users",
"s3_users": [
{
"id": 123,
"s3uid": "7VT1xrnQbWSIQhoOrAngpLUL5reuFcXY",
"email": "[email protected]",
"billing": "whmcs",
"region": "NL",
"storage_type": "Standard",
"quota": 5000,
"traffic": 12.5,
"storage_usage": 45.2,
"service": {
"next_commit_date": "2024-02-15",
"cancellation_date": null,
"termination_date": null,
"termination_unix_date": null,
"cancellation_unix_date": null,
"status": "active"
}
}
]
}
Failure response
``` { "code": -1, "message": "s3/get_users: customer not found" }
```
s3/history¶
Returns the change history for the specified S3 plan or account by ID.
HTTP Method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: history |
| id | ❌ | int | Identifier of the S3 plan or account to retrieve history for |
| token | ✅ | string | Authorization token |
Example Request
Example of a successful response
{
"result": "OK",
"action": "history",
"data": [
{
"id": 1542,
"entity_id": 12,
"entity_type": "s3_plan",
"action": "update",
"description": "Billing plan updated",
"user_id": 5,
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": 1541,
"entity_id": 12,
"entity_type": "s3_plan",
"action": "create",
"description": "New billing plan created",
"user_id": 5,
"created_at": "2024-01-10T08:15:00Z"
}
]
}
s3/list_plans¶
Returns a list of available S3 billing plans. Hides inactive plans for clients (if no s3_test tag), for administrators it can return a specific plan by ID.
HTTP Method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: list_plans |
| token | ✅ | string | Authorization token |
| id | ❌ | int | ID of a specific plan (works only for administrators, returns a single object instead of a list) |
Example Request
Example of a successful response
{
"result": "OK",
"action": "list_plans",
"plans": [
{
"id": 1,
"name": "S3 Standard NL",
"active": 1,
"quota": 5000,
"storage_type": "standard",
"bandwidth_limit": 0,
"locations": "NL,DE",
"monthly_rub": 1500,
"monthly_eur": 15.0,
"monthly_usd": 16.5,
"traffic_overage_price_rub": 0.05,
"traffic_overage_price_eur": 0.0005,
"traffic_overage_price_usd": 0.0006,
"storage_overage_price_rub": 0.01,
"storage_overage_price_eur": 0.0001,
"storage_overage_price_usd": 0.0001,
"price": {
"monthly_rub": 1500,
"monthly_eur": 15.0,
"monthly_usd": 16.5
},
"tags": []
}
]
}
s3/show_key¶
Returns the decrypted access key (access_key or secret_key) for the specified S3 account.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_key |
| token | ✅ | string | User authorization token |
| s3uid | ✅ | string | Unique identifier of the S3 account |
| s3_key | ✅ | string | Type of key to return: 'access_key' or 'secret_key' |
Example Request