Hosting Management ============== Index ----------------- ### Hosting management resources - [List of all hostings](#hostings) - [Get a hosting detail](#hosting) ### Webhosting - Webhosting domains - [List of all webhosting domains](#hosting-domains) - [Get a webhosting domain detail](#hosting-domain) - Stats - [Get hosting size](#hosting-size) - [Get hosting domains](#hosting-domain-usage) - [Get FTP size](#hosting-ftp-size) ### Databases - DB management - [List of all databases](#dbs) - [List of all databases users](#dbs-users) - [Get database detail](#db) - [Create new database](#db-post) - [Update database](#db-put) - [Delete database](#db-delete) - Stats - [Size history](#db-size) - [CPU load history](#db-cpu) ### Mailboxes - Mailboxes management - [List of all mailboxes](#mailboxes) - [Get mailbox detail](#mailbox) - [Create new mailbox](#mailbox-post) - [Update mailbox](#mailbox-put) - [Delete mailbox](#mailbox-delete) - Stats - [Mailbox size history per hosting](#mailbox-size) - [Mailbox size history per domain](#mailbox-domain-size) ### FTP accounts - FTP accounts management - [List of all FTP accounts](#ftp-accounts) - [Get FTP account detail](#ftp-account) - [Create new FTP account](#ftp-account-create) - [Update FTP account](#ftp-account-update) - [Delete FTP account](#ftp-account-delete) List of all hostings {#hostings} -------------------- Available parameters: - `page` (int, not required) - `pagesize` (int, not required) >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": 300000, "name": "hostingname_1", "uuid": "223114ae-7abb-4b9f-8788-0c4795d7257b" }, { "id": 400000, "name": "hostingname_2", "uuid": "d3860eb5-caeb-42d7-a2f4-591f45996fe2" } ], "pager": { "page": 1, "pagesize": null, "items": 2 } } ``` Get a hosting detail {#hosting} ------------------------------- Get hosting by service_id or uuid. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id-or-uuid" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id-or-uuid HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": 300000, "name": "hostingname_1", "uuid": "223114ae-7abb-4b9f-8788-0c4795d7257b" } ``` List of all webhosting domains (vhosts) {#hosting-domains} ------------------------------------------------- >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/vhost" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/vhost HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": 114504, "domain": "blablabla.com", "sub": "ahoj", "webOnStorage": "blablabla.com", "subOnStorage": "blablabla.com/sub", "logsOnStorage": "logs", "disabled": false, "keepAliveOff": false, "phpOpenBaseDir": false, "phpOpenBaseDirStorage": false, "phpOpenBaseDirAll": false, "phpOpenBaseWebInWeb": false, "nonExistSubDomainsToWeb": false, "phpMysql51Default": true, "phpMysql50Default": false, "phpMysql55Default": false, "phpSafeModeOff": false, "phpRegisterGlobalsOff": false, "phpUploadMaxFilesize": 48, "phpMemoryLimit": 48, "phpPostMaxSize": 48, "phpMaxExecutionTime": 30 }, { "id": 114516, "domain": "hosting20testtest.sk", "sub": "blog", "webOnStorage": "hosting20testtest.sk/web", "subOnStorage": "hosting20testtest.sk/sub", "logsOnStorage": "logs", "disabled": false, "keepAliveOff": false, "phpOpenBaseDir": false, "phpOpenBaseDirStorage": false, "phpOpenBaseDirAll": false, "phpOpenBaseWebInWeb": false, "nonExistSubDomainsToWeb": true, "phpMysql51Default": true, "phpMysql50Default": false, "phpMysql55Default": false, "phpSafeModeOff": false, "phpRegisterGlobalsOff": false, "phpUploadMaxFilesize": 48, "phpMemoryLimit": 48, "phpPostMaxSize": 48, "phpMaxExecutionTime": 30 } ], "pager": { "page": 1, "pagesize": null, "items": 2 } } ``` Get a webhosting domain (vhost) detail {#hosting-domain} ------------------------------------------ >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/vhost/:id" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/vhost/:id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": 114504, "domain": "blablabla.com", "sub": "ahoj", "webOnStorage": "blablabla.com", "subOnStorage": "blablabla.com/sub", "logsOnStorage": "logs", "disabled": false, "keepAliveOff": false, "phpOpenBaseDir": false, "phpOpenBaseDirStorage": false, "phpOpenBaseDirAll": false, "phpOpenBaseWebInWeb": false, "nonExistSubDomainsToWeb": false, "phpMysql51Default": true, "phpMysql50Default": false, "phpMysql55Default": false, "phpSafeModeOff": false, "phpRegisterGlobalsOff": false, "phpUploadMaxFilesize": 48, "phpMemoryLimit": 48, "phpPostMaxSize": 48, "phpMaxExecutionTime": 30 } ``` Get hosting size {#hosting-size} ------------------------------------------ >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/size-stats" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/size-stats HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "hosting": "testing_sk", "used": 3.2723, "free": 46.72765, "available": 50 } ``` Get hosting domains usage {#hosting-domain-usage} ------------------------------------------ >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/domain-stats" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/domain-stats HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "hosting": "testing_sk", "used": 28, "free": 2, "available": 30 } ``` Get FTP size {#hosting-ftp-size} ------------------------------------------ >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/ftp-stats" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/ftp-stats HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "hosting": "testing_sk", "used": 3.308377265930176, "free": 45.77929973602295, "available": 50 } ``` List of all databases {#dbs} ------------------------------------------ >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/db" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/db HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": 239365, "dbName": "pm56j8m60i808w", "dbUser": "pm56j8m60i808w", "dbType": "mariadb105", "deleted": false, "disabled": false, "domain": "testingdomain.sk", "note": "wordpress" } ], "pager": { "items": 1, "page": 1, "pagesize": null }, "domains": [ "testingdomain.sk" ] } ``` List of all databases users {#dbs-users} ------------------------------------------ >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/dbusers" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/dbusers HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items":[ { "id":239369, "dbUser":"TestingUser1", "domain":"testingdomain.sk", "dbType":"mariadb105" }, { "id":237365, "dbUser":"TestingUser", "domain":"testingdomain2.sk", "dbType":"mariadb103" } ], "domains":[ "testingdomain.sk", "testingdomain2.sk" ], "pager":{ "page":1, "pagesize":null, "items":2 } } ``` Get database detail {#db} ------------------------- >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": 239365, "dbName": "pm56j8m60i808w", "dbUser": "pm56j8m60i808w", "dbType": "mariadb105", "deleted": false, "disabled": false, "domain": "testingdomain.sk", "note": "wordpress" } ``` >Response `404` ```json { "code": 404, "message": "Database not found" } ``` Create new database {#db-post} ------------------------------ #### Parameters: | Name | Type | Required | Comment | |-----------------------|--------|----------|------------------------------------------------------------------------------------| | **domain** | string | yes | domain in selected hosting (sometimes not required) | | **dbName** | string | yes | database name | | **dbUser** | string | yes | database user | | **dbPassword** | string | no | password required when creating new user, when assigning existing do not send | | **dbType** | string | yes | choose one from: `mariadb105`, `mariadb103`, `mysql80`, `mysql57`, `postgresql100` | | **defaultCollation** | string | yes | default character encoding | | note | string | no | your note | >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/db" -v -u key:signature -H "Content-Type: application/json" -H "Date: request_date_time" -X POST \ -d '{"domain": "aaa.sk", "dbName": "testdb", "dbType": "mariadb105", "dbUser": "testdb", "defaultCollation": "utf8_general_ci", "note": "test"}' ``` >Request ```http POST https://rest.websupport.sk/v1/user/:id/hosting/:id/db HTTP/1.1 Accept: application/json Content-Type: application/json { "domain": "aaa.sk", "dbName": "testdb", "dbPassword": "testdb", "dbType": "mariadb105", "dbUser": "testdb", "defaultCollation": "utf8_general_ci", "note": "test" } ``` >Response `200` ```json { "item": { "id": null, "dbName": "testdb", "dbUser": "testdb", "dbType": "mariadb105", "deleted": false, "disabled": false, "domain": "aaa.sk", "note": "test" }, "errors": {}, "status": "success" } ``` >Validation error `200` ```json { "item": { "id": null, "dbName": "testdb", "dbUser": "testdb", "dbType": "mariadb105", "deleted": false, "disabled": false, "domain": "aaa.sk", "note": "test" }, "errors": { "dbName": [ "Db Name cannot be blank." ] }, "status": "error" } ``` Update database {#db-put} ------------------------------ #### Parameters: | Name | Type | Required | Comment | |------------|--------|----------|--------------------------------------| | dbPassword | string | no | password | | note | string | no | note | >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id" -v -u key:signature -H "Content-Type: application/json" -H "Date: request_date_time" -X PUT \ -d '{"dbPassword": "asdf", "note": "test"}' ``` >Request ```http PUT https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id HTTP/1.1 Accept: application/json Content-Type: application/json { "dbPassword": "testdb", "note": "test" } ``` >Response `200` ```json { "item": { "id": 1234, "dbName": "testdb", "dbUser": "testdb", "dbType": "mariadb105", "deleted": false, "disabled": false, "domain": "aaa.sk", "note": "test" }, "errors": {}, "status": "success" } ``` >Validation error `200` ```json { "item": { "id": 1234, "dbName": "testdb", "dbUser": "testdb", "dbType": "mariadb105", "deleted": false, "disabled": false, "domain": "aaa.sk", "note": "test" }, "errors": { "dbPassword": [ "Db Password is too short (minimum is 8 characters)." ] }, "status": "error" } ``` Delete a database {#db-delete} ------------- No parameters required. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id" -X DELETE -u key:signature -H "Date: request_date_time" ``` >Request ```http DELETE https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "errors": {}, "item": { "id": 1234, "dbName": "testdb", "dbUser": "testdb", "dbType": "mariadb105", "deleted": false, "disabled": false, "domain": "aaa.sk", "note": "test" }, "status": "success" } ``` DB size {#db-size} ------------------ Parameters for changing time interval and period: - **interval** (string) `day` or `hour` - **length** (integer) number of shown measurements (time period depends on chosen interval) >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id/size-stats" -u key:signature -H "Date: request_date_time" ``` >Curl (with parameters) ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id/size-stats" -G -d interval=hour -d length=12 -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id/size-stats HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "size": 12044, "timestamp": 1428357600 }, { "size": 12544, "timestamp": 1428444000 }, ... ], "range": [ 1428332843, 1431011242 ] } ``` DB cpu {#db-cpu} ------------------ Parameters for changing time interval and period: - **interval** (string) `day`, `hour` or `minute` - **length** (integer) number of shown measurements (time period depends on chosen interval) >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id/cpu-stats" -u key:signature -H "Date: request_date_time" ``` >Curl (with parameters) ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id/cpu-stats" -G -d interval=hour -d length=12 -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/db/:id/cpu-stats HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "access_denied": 0, "binlog_bytes_written": 0, "busy_time": 0, "bytes_received": 0, "bytes_sent": 0, "commit_transactions": 0, "concurrent_connections": 0, "connected_time": 0, "cpu_time": 10, "denied_connections": 0, "empty_queries": 0, "lost_connections": 0, "other_commands": 0, "rollback_transactions": 0, "rows_fetched": 0, "rows_updated": 0, "select_commands": 0, "table_rows_read": 0, "timestamp": 1428357600, "total_connections": 0, "update_commands": 0 }, ... ], "range": [ 1428332843, 1431011242 ] } ``` List of all mailboxes {#mailboxes} - >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/mailbox" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/mailbox HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": 1234, "domain": "testingdomain.sk", "domainId": 12345, "email": "foo@testingdomain.sk", "mailBox": "foo", "deleted" : false, "disabled": false, "imapDisabled": false, "pop3Disabled": false, "ipCheck": false, "countryCheck": true, "countries": [ "SK", "CZ", "HU", "AT" ], "note": "" }, { "id": 1235, "domain": "testingdomain.sk", "domainId": 12345, "email": "bar@testingdomain.sk", "mailBox": "bar", "deleted" : false, "disabled": false, "imapDisabled": false, "pop3Disabled": false, "note": "", "ipCheck": false, "countryCheck": false }, ... ], "pager": { "items": 1, "page": 1, "pagesize": null }, "domains": [ "testingdomain.sk" ] } ``` Get mailbox detail {#mailbox} - >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/mailbox/:id" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/mailbox/:id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": 1234, "domain": "testingdomain.sk", "domainId": 12345, "email": "foo@testingdomain.sk", "mailBox": "foo", "deleted" : false, "disabled": false, "imapDisabled": false, "pop3Disabled": false, "ipCheck": false, "countryCheck": true, "countries": [ "SK", "CZ", "HU", "AT" ], "note": "" } ``` Create new mailbox {#mailbox-post} - #### Parameters: | Name | Type | Required | Default | Comment | |----------------|--------|----------|-----------------------|--------------------------------------| | **email** | string | yes | | mailbox name e.g. `foo` for `foo@testdomain.sk` | | **password** | string | yes | | mailbox password | | ipCheck | boolean | no | `false` | Enable access to selected IP addresses | | ips | Array | no | | Array of IPs for ipCheck in format `1.2.3.0/24` or `1.2.3.4` | | countryCheck | boolean | no | `true` | Enable access to selected countries | | countries | Array | no | `["SK", "CZ", "HU", "AT"]` | Array of countries for countryCheck, 2-letter country identifier as `SK`,`CZ` etc. | | imapDisabled | boolean | no | `false` | disable IMAP | | pop3Disabled | boolean | no | `false` | disable POP3 | | note | string | no | | your note | >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/domain/:id/mailbox" -v -u key:signature -H "Content-Type: application/json" -H "Date: request_date_time" -X POST \ -d '{"email": "foonew", "password": "testpassword", "ipCheck": true, "ips": ["1.2.3.4", "8.8.8.8"], "countryCheck": true, "countries": ["SK", "CZ", "HU"], "note": "test"}' ``` >Request ```http POST https://rest.websupport.sk/v1/user/:id/hosting/:id/domain/:id/mailbox HTTP/1.1 Accept: application/json Content-Type: application/json { "email": "foonew", "password": "testpassword", "ipCheck": true, "ips": ["1.2.3.4", "8.8.8.8"], "countryCheck": true, "countries": [ "SK", "CZ", "HU" ], "note": "test" } ``` >Response `200` ```json { "item": { "id": 1234, "domain": "testingdomain.sk", "domainId": 12345, "email": "foonew@testingdomain.sk", "mailBox": "foonew", "deleted" : false, "disabled": false, "imapDisabled": false, "pop3Disabled": false, "ipCheck": true, "ips": ["1.2.3.4/32", "8.8.8.8/32"], "countryCheck": true, "countries": [ "SK", "CZ", "HU" ], "note": "test" }, "errors": {}, "status": "success" } ``` >Validation error `200` ```json { "item": { "id": null, "domain": "testingdomain.sk", "domainId": 12345, "email": "@testingdomain.sk", "mailBox": "", "deleted" : false, "disabled": false, "imapDisabled": false, "pop3Disabled": false, "ipCheck": true, "ips": ["1.2.3.4/32", "8.8.8.8/32"], "countryCheck": true, "countries": [ "SK", "CZ", "HU" ], "note": "test" }, "errors": { "email": [ "Email cannot be blank.", "Email is not a valid email address." ], "password": [ "Password cannot be blank." ] }, "status": "error" } ``` Update mailbox {#mailbox-put} - #### Parameters: | Name | Type | Required | Comment | |----------------|--------|----------|--------------------------------------| | password | string | no | mailbox password | | ipCheck | boolean | no | Enable access to selected IP addresses | | ips | Array | no | Array of IPs for ipCheck in format `1.2.3.0/24` or `1.2.3.4` | | countryCheck | boolean | no | Enable access to selected countries | | countries | Array | no | Array of countries for countryCheck, 2-letter country identifier as `SK`,`CZ` etc. | | imapDisabled | boolean | no | disable IMAP | | pop3Disabled | boolean | no | disable POP3 | | note | string | no | your note | >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/domain/:id/mailbox/:id" -v -u key:signature -H "Content-Type: application/json" -H "Date: request_date_time" -X POST \ -d '{"password": "changedpassword", "ipCheck": false, "countryCheck": true, "countries": ["SK"] "note": "test update"}' ``` >Request ```http POST https://rest.websupport.sk/v1/user/:id/hosting/:id/domain/:id/mailbox/:id HTTP/1.1 Accept: application/json Content-Type: application/json { "password": "changedpassword", "ipCheck": false, "countryCheck": true, "countries": [ "SK" ], "note": "test update" } ``` >Response `200` ```json { "item": { "id": 1234, "domain": "testingdomain.sk", "domainId": 12345, "email": "foo@testingdomain.sk", "mailBox": "foo", "deleted" : false, "disabled": false, "imapDisabled": false, "pop3Disabled": false, "ipCheck": false, "countryCheck": true, "countries": [ "SK" ], "note": "test update" }, "errors": {}, "status": "success" } ``` >Validation error `200` ```json { "item": { "id": 1234, "domain": "testingdomain.sk", "domainId": 12345, "email": "foo@testingdomain.sk", "mailBox": "foo", "deleted" : false, "disabled": false, "imapDisabled": false, "pop3Disabled": false, "ipCheck": false, "countryCheck": true, "countries": [ "SK" ], "note": "test update" }, "errors": { "password": [ "Password cannot be blank." ] }, "status": "error" } ``` Delete mailbox {#mailbox-delete} - No parameters required. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/domain/:id/mailbox/:id" -X DELETE -u key:signature -H "Date: request_date_time" ``` >Request ```http DELETE https://rest.websupport.sk/v1/user/:id/hosting/:id/domain/:id/mailbox/:id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "errors": {}, "item": { "id": 1234, "domain": "testingdomain.sk", "domainId": 12345, "email": "foo@testingdomain.sk", "mailBox": "foo", "deleted" : false, "disabled": false, "imapDisabled": false, "pop3Disabled": false, "ipCheck": false, "countryCheck": true, "countries": [ "SK" ], "note": "test update" }, "status": "success" } ``` Email size history per hosting {#mailbox-size} ------------------ Get email size history per hosting (multiple domains). Parameters for changing time interval and period: - **interval** (string) `day` or `hour` - **length** (integer) number of shown measurements (time period depends on chosen interval) >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/mail/size-stats" -u key:signature -H "Date: request_date_time" ``` >Curl (with parameters) ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/mail/size-stats" -G -d interval=hour -d length=12 -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/mail/size-stats HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "domains": [ "testdomain1.sk", "testdomain2.sk" ], "items": [ { "size": 2903830, "timestamp": 1434924000 }, { "size": 2904153, "timestamp": 1435010400 }, ... ], "range": [ 1434880348, 1437558747 ] } ``` Email size history per domain {#mailbox-domain-size} ------------------ Get email size history per domain. Parameters for changing time interval and period: - **interval** (string) `day` or `hour` - **length** (integer) number of shown measurements (time period depends on chosen interval) >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/mail/:domain/size-stats" -u key:signature -H "Date: request_date_time" ``` >Curl (with parameters) ```sh curl "https://rest.websupport.sk/v1/user/:id/hosting/:id/mail/:domain/size-stats" -G -d interval=hour -d length=12 -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/hosting/:id/mail/:domain/size-stats HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "size": 2903830, "timestamp": 1434924000 }, { "size": 2904153, "timestamp": 1435010400 }, ... ], "range": [ 1434880348, 1437558747 ] } ``` # FTP accounts ## List of all FTP accounts {#ftp-accounts} >Curl ```sh curl "https://rest.websupport.sk/v1/user/:userId/hosting/:hostingId/ftp-account" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:userId/hosting/:hostingId/ftp-account HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": 614561, "createTime": 1620907956, "hostingId": 1305518, "login": "foo.testingdomain.sk", "disabled": false, "note": "API test" }, { "id": 614594, "createTime": 1620908851, "hostingId": 1305518, "login": "bar.testingdomain.sk", "disabled": false, "note": "API test 2" } ], "pager": { "page": 1, "pagesize": null, "items": 2 } } ``` ## Get FTP account detail {#ftp-account} >Curl ```sh curl "https://rest.websupport.sk/v1/user/:userId/hosting/:hostingId/ftp-account/:ftpAccountId" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:userId/hosting/:hostingId/ftp-account/:ftpAccountId HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": 614561, "createTime": 1620907956, "hostingId": 1305518, "login": "foo.testingdomain.sk", "dir": "/", "disabled": false, "ftpEnabled": false, "sshEnabled": true, "countryCheck": true, "ipCheck": true, "countries": [ "CZ", "HU", "SK" ], "ips": [], "note": "API test" } ``` ## Create new FTP account {#ftp-account-create} ### Parameters: | Name | Type | Required | Default | Comment | |----------------|---------|----------|-----------------------|--------------------------------------| | **login** | string | yes | | FTP login `foo` for `foo.testingdomain.sk` | | **password** | string | yes | | FTP password | | dir | string | no | `/` | Enable access to directory | | disabled | boolean | no | | Deactivate account | | ftpEnabled | boolean | no | `true` | Enable FTP | | sshEnabled | boolean | no | | Enable SFTP | | countryCheck | boolean | no | `false` | Enable access to selected countries | | ipCheck | boolean | no | `false` | Enable access to selected IP addresses | | countries | Array | no | `["SK", "CZ", "HU"]` | Array of allowed countries in ISO 3166-1 alpha-2 code, e.g. `SK`,`CZ` etc. | | ips | Array | | | Array of allowed IPs in format `1.2.3.0/24` or `1.2.3.4` | | note | string | | | Your note | >Curl ```sh curl "https://rest.websupport.sk/v1/user/:userId/hosting/:hostingId/ftp-account" -v -u key:signature -H "Content-Type: application/json" -H "Date: request_date_time" -X PUT \ -d '{"login": "foo", "password": "testpassword", "ftpEnabled": false, "sshEnabled": false, "ipCheck": true, "ips": ["1.2.3.4", "8.8.8.8"], "countryCheck": false, "countries": [ "SK", "CZ", "HU" ], "note": "API test"}' ``` >Request ```http PUT https://rest.websupport.sk/v1/user/:userId/hosting/:hostingId/ftp-account HTTP/1.1 Accept: application/json Content-Type: application/json { "login": "foo", "password": "testpassword", "ftpEnabled": false, "sshEnabled": false, "ipCheck": true, "ips": ["1.2.3.4", "8.8.8.8"], "countryCheck": false, "countries": [ "SK", "CZ", "HU" ], "note": "API test" } ``` >Response `200` ```json { "status": "success", "item": { "id": 614561, "createTime": 1621254987, "hostingId": 1305518, "login": "foo.testingdomain.sk", "dir": "/", "disabled": false, "ftpEnabled": false, "sshEnabled": false, "countryCheck": false, "ipCheck": true, "countries": [ "CZ", "SK", "HU" ], "ips": [], "note": "API test" } } ``` >Validation error `200` ```json { "status": "error", "errors": { "login": [ "Login already used." ], "password": [ "This field is required." ] } } ``` ## Update FTP account {#ftp-account-update} ### Parameters: | Name | Type | Required | Default | Comment | |----------------|---------|----------|-----------------------|--------------------------------------| | **login** | string | yes | | FTP login `foo` for `foo.testingdomain.sk` | | **password** | string | yes | | FTP password | | dir | string | no | `/` | Enable access to directory | | disabled | boolean | no | | Deactivate account | | ftpEnabled | boolean | no | `true` | Enable FTP | | sshEnabled | boolean | no | | Enable SFTP | | countryCheck | boolean | no | `false` | Enable access to selected countries | | ipCheck | boolean | no | `false` | Enable access to selected IP addresses | | countries | Array | no | `["SK", "CZ", "HU"]` | Array of allowed countries in ISO 3166-1 alpha-2 code, e.g. `SK`,`CZ` etc. | | ips | Array | | | Array of allowed IPs in format `1.2.3.0/24` or `1.2.3.4` | | note | string | | | Your note | >Curl ```sh curl "https://rest.websupport.sk/v1/user/:userId/hosting/:hostingId/ftp-account/:ftpAccountId" -v -u key:signature -H "Content-Type: application/json" -H "Date: request_date_time" -X POST \ -d '{"login": "foo", "password": "testpassword", "ftpEnabled": false, "sshEnabled": false, "ipCheck": true, "ips": ["1.2.3.4", "8.8.8.8"], "countryCheck": false, "countries": [ "SK", "CZ", "HU" ], "note": "API test"}' ``` >Request ```http POST https://rest.websupport.sk/v1/user/:userId/hosting/:hostingId/ftp-account/:ftpAccountId HTTP/1.1 Accept: application/json Content-Type: application/json { "login": "foo", "password": "testpassword", "ftpEnabled": false, "sshEnabled": false, "ipCheck": true, "ips": ["1.2.3.4", "8.8.8.8"], "countryCheck": false, "countries": [ "SK", "CZ", "HU" ], "note": "API test" } ``` >Response `200` ```json { "status": "success", "item": { "id": 614561, "createTime": 1620907956, "hostingId": 1305518, "login": "foo.testingdomain.sk", "dir": "/", "disabled": false, "ftpEnabled": false, "sshEnabled": false, "countryCheck": false, "ipCheck": true, "countries": [ "CZ", "HU", "SK" ], "ips": [], "note": "API test" } } ``` >Validation error `200` ```json { "status": "error", "errors": { "login": [ "Login already used." ] } } ``` ## Delete FTP account {#ftp-account-delete} No parameters required. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:userId/hosting/:hostngId/ftp-account/:ftpAccountId" -X DELETE -u key:signature -H "Date: request_date_time" ``` >Request ```http DELETE https://rest.websupport.sk/v1/user/:userId/hosting/:hostngId/ftp-account/:ftpAccountId HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "status": "success", "item": { "id": 614561, "createTime": 1620908851, "hostingId": 1305518, "login": "foo.testingdomain.sk", "dir": "/", "disabled": false, "ftpEnabled": true, "sshEnabled": true, "countryCheck": true, "ipCheck": true, "countries": [ "HU", "CZ", "SK" ], "ips": [], "note": "test API" } } ```