Անցնել պարունակությանը

s3.php

S3 storage management module: creating and deleting accounts, managing buckets and files, obtaining usage statistics, managing pricing plans and billing.

API Methods

Method Action Description
create_account create S3 account Creates a new S3 account (bucket) for the client, links it to a pricing plan, and creates a corresponding order in billing.
create_bucket create S3 bucket Creates a new bucket for an existing user's S3 account.
create_order create S3 account order Creates a new S3 account (bucket) for the client, links it to a pricing plan, and creates a corresponding order in the billing system.
delete_account delete S3 account Deletes a user's S3 account, performs action audit, and logs the operation in history.
delete_bucket delete S3 bucket Deletes the specified bucket from S3 storage if it belongs to the user.
delete_file delete file from S3 bucket Deletes the specified file from an S3 bucket. Requires authorization and access rights to the account.
delete_payment_account delete payment account (subscription cancellation request) Requests S3 service cancellation, initiating the deletion/unsubscription process. Upon successful execution, returns information about the cancellation date.
get_buckets get list of buckets Returns a list of the user's S3 buckets, traffic usage information, and snapshots.
get_buckets_rmq get bucket info via RMQ Returns a list of the user's buckets, their usage information, billing data, metrics, and S3 access credentials.
get_files get list of files in bucket Returns a list of files and folders in the specified S3 bucket with pagination and search support.
get_users get list of S3 users Returns a list of S3 users with detailed information about plans, traffic consumption, and service data.
history get history Returns event logs for the specified S3 account or user.
list_plans get plan lists Returns a list of available S3 plans considering user permissions, location, and client currency. Administrators can view a specific plan by ID.
show_key get S3 access keys Returns the decrypted secret key or access key for the specified S3 account.

s3/cancel_payment_account_deletion

Cancels the S3 account deletion process initiated due to payment issues. Resets the suspension reason and updates commit dates.

HTTP-method: POST

Parameters:

Parameter Required Type Description
token string Authorization token
id int User ID (for administrators)
s3uid string S3 account UID

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE"
Example of a successful response
{
"result": "OK",
"action": "cancel_payment_account_deletion",
"next_commit_date": "2024-12-31",
"termination_date": "2025-01-15"
}
Failure response

``` { "code": -1, "message": "S3 account not found for this customer" }

```

s3/create_account

Creates a new S3 account (bucket) for the client, links it to a pricing plan, and creates a corresponding order in billing.

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: create_account
token string Authorization token
bucket_name string Name of the bucket being created
plan_id int Pricing plan ID
location string Data storage location (region). Default is NL

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=create_account" \
--data "token=HOSTKEY_TOKEN" \
--data "bucket_name=VALUE" \
--data "plan_id=VALUE"
Example of a successful response
{
"result": "OK",
"action": "create_account",
"s3uid": "5f8e9d2a1b0c4e3f7a6b5d4c3e2f1a0b"
}
Failure response

``` { "code": -1, "message": "S3 account was being created, but a bucket creation error occurred: Invalid bucket name." }

```

s3/create_bucket

Creates a new bucket for an existing user's S3 account.

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: create_bucket
token string Authorization token
s3uid string Unique S3 account UID of the user
bucket_name string Name of the bucket being created

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=create_bucket" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE" \
--data "bucket_name=VALUE"
Example of a successful response
{
"result": "OK",
"action": "create_bucket",
"message": {
"status": "success",
"bucket_name": "my-new-bucket"
}
}
Failure response

``` { "-1": { "code": -1, "message": "S3 account not found for this customer" }, "-2": { "code": -1, "message": "Create bucket error: Invalid bucket name." } }

```

s3/create_order

Creates a new S3 account (bucket) for the client, links it to a pricing plan, and creates a corresponding order in the billing system.

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: create_order
token string Authorization token
bucket_name string Name of the bucket being created
plan_id integer Selected pricing plan ID
location string Data storage location (region). Default is NL

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=create_order" \
--data "token=HOSTKEY_TOKEN" \
--data "bucket_name=VALUE" \
--data "plan_id=VALUE"
Example of a successful response
{
"result": "OK",
"action": "create_order",
"s3uid": "5f8e2a1b9c0d4e3f7a6b5c4d3e2f1a0b"
}
Failure response

``` { "code": -1, "message": "S3 account was being created, however a bucket creation error occurred - Invalid bucket name. Please contact the administrator." }

```

s3/delete_account

Deletes a user's S3 account, performs action audit, and logs the operation in history.

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: delete_account
token string Authorization token
id int Administrator ID (if the action is performed by an employee)
s3uid string Unique S3 account UID for deletion
reason string Reason for account deletion

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=delete_account" \
--data "token=YOUR_TOKEN" \
--data "s3uid=5f8e9d2a-1b2c-4d3e-af01-987654321abc"
Example of a successful response
{
"result": "OK",
"action": "delete_account",
"s3uid": "5f8e9d2a-1b2c-4d3e-af01-987654321abc"
}
Failure response

``` { "code": -1, "message": "S3 account not found for this customer" }

```

s3/delete_bucket

Deletes the specified bucket from S3 storage if it belongs to the user.

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: delete_bucket
token string Authorization token
id integer User ID (for administrators)
s3uid string S3 account UID
bucket_name string Name of the bucket to be deleted

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=delete_bucket" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE" \
--data "bucket_name=VALUE"
Example of a successful response
{
"result": "OK",
"action": "delete_bucket",
"message": "object (S3 bucket deletion result)"
}
Failure response

``` { "code": -1, "message": "Delete S3 bucket error: Bucket not empty" }

```

s3/delete_file

Deletes the specified file from an S3 bucket. Requires authorization and access rights to the account.

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Action (must be delete_file)
token string Authorization token
s3uid string Unique S3 account UID
bucket_name string Bucket name
filename string Path or name of the file to delete

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=delete_file" \
--data "token=VALUE" \
--data "s3uid=VALUE" \
--data "bucket_name=VALUE" \
--data "filename=VALUE"
Example of a successful response
{
"result": "OK",
"action": "delete_file",
"message": "string"
}
Failure response

``` { "code": -1, "message": "Delete S3 file error: {error}. Response: {response}" }

```

s3/delete_payment_account

Requests S3 service cancellation, initiating the deletion/unsubscription process. Upon successful execution, returns information about the cancellation date.

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: delete_payment_account
token string Authorization token
id integer User ID (for administrators)
s3uid string S3 account UID
reason string Reason for cancellation/unsubscription

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=delete_payment_account" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE"
Example of a successful response
{
"result": "OK",
"action": "delete_payment_account",
"cancellation_date": "2024-12-31",
"cancellation_date_origin": "31.12.2024",
"reason_suspend": "User requested cancellation"
}
Failure response

``` { "code": -1, "message": "S3 account not found for this customer" }

```

s3/get_buckets

Returns a list of the user's S3 buckets, traffic usage information, and snapshots.

HTTP-method: POST|GET

Parameters:

Parameter Required Type Description
action string Method identifier: get_buckets
token string Authorization token
id integer User ID (for administrators)
s3uid string S3 account UID

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=get_buckets" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE"
Example of a successful response
{
"result": "OK",
"action": "get_buckets",
"message": [
{
"Name": "my-bucket-name",
"usage": 1024,
"creation_date": "2023-10-01T12:00:00Z"
}
],
"bandwidth": 512,
"snapshot": {
"bandwidth_usage": 1024,
"storage_usage": 500,
"created_at": "2023-10-27T10:00:00Z"
}
}
Failure response

``` { "code": -1, "message": "S3 account not found for this customer" }

```

s3/get_buckets_rmq

Returns a list of the user's buckets, their usage information, billing data, metrics, and S3 access credentials.

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: get_buckets_rmq
token string Authorization token
id integer Client ID (for administrators)
s3uid string User S3 UID

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=get_buckets_rmq" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE"
Example of a successful response
{
"result": "OK",
"action": "get_buckets_rmq",
"message": [
{
"name": "example-bucket",
"usage": 1024
},
{
"name": "test-bucket",
"usage": 512
}
],
"usage_storage": 1536,
"quota": 5000,
"metering": {
"total_traffic_gb": 1.5,
"total_storage_peak_gb": 2.0
},
"billing": {
"service_id": 123,
"currency": "EUR",
"period": {
"start": "2024-01-01T00:00:00Z",
"end": "2024-02-01T00:00:00Z"
},
"limits": {
"traffic_gb": 10.0,
"storage_gb": 50
},
"current_period": {
"traffic_used_gb": 1.5,
"storage_used_gb": 2.0,
"billed_traffic_gb": 0,
"billed_storage_gb": 0,
"billed_traffic_amount": 0,
"billed_storage_amount": 0
},
"overage": null,
"records": [],
"error": "billing_unavailable"
},
"access_key": "AKIAEXAMPLE123456789",
"secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"endpoint": "s3.example.com"
}
Failure response

``` { "code": -1, "message": "S3 account not found for this customer" }

```

s3/get_files

Returns a list of files and folders in the specified S3 bucket with pagination and search support.

HTTP-method: POST|GET

Parameters:

Parameter Required Type Description
action string Method identifier: get_files
token string Authorization token
s3uid string Unique S3 account UID
bucket_name string Bucket name
continuation_token string Pagination token (next page)
max_keys int Maximum number of keys in the response (max. 100)
search string Search query by filename

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=get_files" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE" \
--data "bucket_name=VALUE"
Example of a successful response
{
"result": "OK",
"action": "get_files",
"files": [
{
"key": "folder/file.txt",
"original_key": "folder/file.txt",
"size": 1024,
"last_modified": "2024-05-20T12:00:00Z"
}
],
"folders": [
{
"key": "folder/",
"original_key": "folder/"
}
],
"next_token": "string_token"
}
Failure response

``` { "code": -1, "message": "S3 account not found for this customer" }

```

s3/get_users

Returns a list of S3 users with detailed information about plans, traffic consumption, and service data.

HTTP-method: POST|GET

Parameters:

Parameter Required Type Description
action string Method identifier: get_users
token string Authorization token
id integer Client ID (for admin)
plan_id integer Pricing plan ID
s3uid string User S3 UID
email string Search by email
billing string Billing (location)
location string Search location
storage_type string Storage type
period_from string Period start date (Y-m-d)
period_to string Period end date (Y-m-d)

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=get_users" \
--data "token=HOSTKEY_TOKEN"
Example of a successful response
{
"result": "OK",
"action": "get_users",
"s3_users": [
{
"id": 123,
"s3uid": "5f8e9a7b-c6d5-4e3f-b2a1-0987654321ab",
"email": "[email protected]",
"billing": "whmcs_itb",
"region": "NL",
"storage_type": "Standard",
"traffic": 15.5,
"storage_usage": 450.2,
"price": {
"EUR": 19.99,
"USD": 21.5,
"RUB": 1850.0
},
"service": {
"id": 456,
"entity_id": 123,
"rate": 19.99,
"service_ident": "a1b2c3d4e5",
"period": "monthly",
"period_start": "2024-01-01T00:00:00Z",
"period_end": "2024-02-01T00:00:00Z",
"next_commit_date": "2024-02-01T00:00:00Z",
"status": "active"
}
}
]
}
Failure response

``` { "code": -1, "message": "customer not found" }

```

s3/history

Returns event logs for the specified S3 account or user.

HTTP-method: POST|GET

Parameters:

Parameter Required Type Description
id integer S3 account or user ID to retrieve history
token string Authorization token

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "id=12345" \
--data "token=HOSTKEY_TOKEN"
Example of a successful response
{
"result": "OK",
"action": "history",
"data": [
{
"id": 12345,
"event": "S3 service [ID=10] created",
"created_at": "2024-05-20T12:00:00Z",
"user_id": 55,
"type": "billing"
}
]
}
Failure response

``` { "code": -1, "message": "S3/history: invalid token, logout" }

```

s3/list_plans

Returns a list of available S3 plans considering user permissions, location, and client currency. Administrators can view 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 Specific plan ID (used by administrators to get detailed information)

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=list_plans" \
--data "token=HOSTKEY_TOKEN"
Example of a successful response
{
"result": "OK",
"action": "list_plans",
"plans": [
{
"id": 1,
"name": "Standard Plan",
"active": 1,
"storage_type": "standard",
"quota": 500,
"location": "NL",
"price": {
"base_price": 10.0,
"price": {
"EUR": 10.0,
"USD": 11.0,
"RUB": 950.0
}
},
"traffic_overage_price": {
"EUR": 0.01,
"USD": 0.01,
"RUB": 1.0
},
"storage_overage_price": {
"EUR": 0.05,
"USD": 0.05,
"RUB": 5.0
}
}
]
}
Failure response

``` { "code": -1, "message": "action required" }

```

s3/show_key

Returns the decrypted secret key or access key for the specified S3 account.

HTTP-method: POST|GET

Parameters:

Parameter Required Type Description
action string Method identifier: show_key
token string Authorization token
s3uid string Unique S3 account UID
s3_key string Type of requested key (secret_key or access_key)

Example Request

curl -s "https://invapi.hostkey.com/s3.php" -X POST \
--data "action=show_key" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE" \
--data "s3_key=secret_key"
Example of a successful response
{
"result": "OK",
"action": "show_key",
"key": "wJalrXUtnFEMI/Kk7EkWDVTAuxPHNFj4BLde{56_example}"
}
Failure response

``` { "code": -1, "message": "S3 account not found for this customer" }

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×