Searching...

Integration manual for API - email

Endpoint

https://api.hukot.net/rest/%api-token%/%method%

You can get your token in hosting administration at admin.hukot.net in section "API access".

Response is sent as JSON object, status of progress is report by HTTP status codes - see below.
In event of error while validating values, 'X-Error-Message' header with description of the error is added.

Coding UTF-8. Access to API is limited to selected IP addresses and depends on approval from provider.

HTTP status codes

Response Description
200 Successfull request
400 Data validation error, check X-Error-Message header for more info
401 Forbidden acces to API; incorrect Token or IP address
402 the tariff of the given object does not allow adding more records - look at X-Error-Message
404 requested record couldn't be found
405 the given API method does not support the given HTTP method; only GET, POST, PUT, and DELETE requests are allowed
409 a record with the same name already exists
500 server error - service unavailable, processing failed on server side
501 API method not implemented

Data types

Type Description
integer any integer
array array of objects
string any printable character
boolean a value of 0, 1, true, false, TRUE, or FALSE

Actions

List of e-mail boxes:

Request:

curl -D - -o - https://api.hukot.net/rest/%api-token%/emails?[page=%pageNumber%] \
-X "GET"

Optional parameter page allow paging results. Implicit value is 0 (1. page of results), maximal value is given by number of records in database.
To find the maximum page value, divide the totalCount by itemsPerPage and round it up to whole number.

Response:

{"totalCount":174,"itemsPerPage":25,"data":["email@domain.cz"]}

Field Object description Data type
totalCount Total amount of records integer
itemsPerPage Amount of records displayed on one page integer
data individual e-mail addresses array

Information about single mailbox / alias

Request:

curl -D - -o - https://api.hukot.net/rest/%api-token%/email/ \
-X "GET"

Response:

{
"name":"email@domain.cz",
"type":1,
"forwarding":["email@domena.cz"],
"autoresponder":0,
"autoresponderSubject":"",
"autoresponderText":"",
"antispam":1,
"advancedSpamFiltering":0,
"keepSpam":0,
"spamTreshold":3,
"spamHiTreshold":0,
"dropHiScoringSpam":false,
"blacklist":["spammer@domain.com"]
}

Parameter Description Data type
name name of mailbox / alias string
type type (1: physical mailbox; 2: alias) integer
forwarding array of e-mail addresses to which copies of incoming messages will be sent array
autoresponder active automatic response boolean
autoresponderSubject subject of automatic response string
autoresponderText text of automatic response string
antispam antispam status boolean
advancedSpamFiltering advanced spam filtering settings boolean
keepSpam emails evaluated as spam deliver to IMAP direcory Spam boolean
spamTreshold mark email as spam if its rating is bigger than the value (SpamAssassin) integer
spamHiTreshold mark email as super spam if its rating is bigger than the value (SpamAssassin) integer
dropHiScoringSpam discard high marked spam emails boolean
blacklist array of emails from which mails are automatically discarded array

Deleting mailbox / alias

Request:

curl -D - -o - https://api.hukot.net/rest/%api-token%/email/ \
-X "DELETE"

Creating mailbox

Request:

curl -N https://api.hukot.net/rest/%api-token%/email \
-X "POST" \
-H "Content-Type:application/x-www-form-urlencoded" -d "name=email@example.com&type=1"

Parameter Description Data type
name* name of mailbox / alias string
password* password string
type* type (1: physical mailbox) integer
[1]
forwarding array of e-mail addresses to which copies of incoming messages will be sent boolean
autoresponder active automatic response boolean
autoresponderSubject subject of automatic response string
autoresponderText text of automatic response string
antispam antispam status boolean
advancedSpamFiltering advanced spam filtering settings boolean
keepSpam emails evaluated as spam deliver to IMAP direcory Spam boolean
spamTreshold mark email as spam if its rating is bigger than the value (SpamAssassin) integer
[1 - 25]
spamHiTreshold mark email as super spam if its rating is bigger than the value (SpamAssassin) integer
[1 - 25]
dropHiScoringSpam discard highly marked spam emails integer
blacklist array of emails from which mails are automatically discarded array

Creating Alias

Request:

curl -N https://api.hukot.net/rest/%api-token%/email \
-X "POST" \
-H "Content-Type:application/x-www-form-urlencoded" -d "name=email@example.com&type=2"

Parameter Description Data type
name* name of mailbox / alias string
type* type (2: alias) integer
[2]
forwarding array of e-mail addresses to which copies of incoming messages will be sent boolean
autoresponder active automatic response boolean
autoresponderSubject subject of automatic response string
autoresponderText text of automatic response string
antispam antispam status boolean
advancedSpamFiltering advanced spam filtering settings boolean
keepSpam emails evaluated as spam deliver to IMAP direcory Spam boolean
spamTreshold mark email as spam if its rating is bigger than the value (SpamAssassin) integer
[1 - 25]
spamHiTreshold mark email as super spam if its rating is bigger than the value (SpamAssassin) integer
[1 - 25]
dropHiScoringSpam discard highly marked spam emails integer

Editing mailbox / alias

Request:

curl -N https://api.hukot.net/rest/%api-token%/email/ \
-X "PUT" \
-H "Content-Type:application/x-www-form-urlencoded" -d "autoresponder=1"

Parameter Description Data type
forwarding array of e-mail addresses to which copies of incoming messages will be sent array
password password
only for physical mailboxes
string
autoresponder active automatic response boolean
autoresponderSubject subject of automatic response string
autoresponderText text of automatic response string
antispam antispam status
for further antispam updates it is necessary to send this parameter in each request
boolean
advancedSpamFiltering advanced spam filtering settings boolean
keepSpam emails evaluated as spam deliver to IMAP direcory Spam boolean
spamTreshold mark email as spam if its rating is bigger than the value (SpamAssassin) integer
[1 - 25]
spamHiTreshold mark email as super spam if its rating is bigger than the value (SpamAssassin) integer
[1 - 25]
dropHiScoringSpam discard highly marked spam emails boolean
blacklist array of emails from which mails are automatically discarded array

Comments

To submit comment you have to be logged-in