2016-04-11 09:45:35 -05:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
< title > iRedAdmin-Pro RESTful API (interact with `curl`)< / title >
< link rel = "stylesheet" type = "text/css" href = "./css/markdown.css" / >
< / head >
< body >
< div id = "navigation" >
< a href = "/index.html" target = "_blank" > < img alt = "iRedMail web site" src = "images/logo-iredmail.png" style = "vertical-align: middle; height: 30px;" / > < span > iRedMail< / span > < / a >
// < a href = "./index.html" > Document Index< / a > < / div > < h1 id = "iredadmin-pro-restful-api-interact-with-curl" > iRedAdmin-Pro RESTful API (interact with < code > curl< / code > )< / h1 >
< div class = "toc" >
< ul >
< li > < a href = "#iredadmin-pro-restful-api-interact-with-curl" > iRedAdmin-Pro RESTful API (interact with curl)< / a > < ul >
< li > < a href = "#summary" > Summary< / a > < / li >
< li > < a href = "#requirements" > Requirements< / a > < / li >
2016-04-11 22:29:47 -05:00
< li > < a href = "#samples" > Samples< / a > < ul >
< li > < a href = "#login-login-post" > Login (/login, POST)< / a > < / li >
< li > < a href = "#domain-domaindomain" > Domain (/domain/< domain> )< / a > < ul >
< li > < a href = "#create-domain-post" > Create domain (POST)< / a > < / li >
< li > < a href = "#delete-domain-delete" > Delete domain (DELETE)< / a > < / li >
< / ul >
< / li >
< li > < a href = "#mail-user-usermail" > Mail User (/user/< mail> )< / a > < ul >
< li > < a href = "#create-mail-user-post" > Create mail user (POST)< / a > < / li >
< li > < a href = "#delete-mail-user-delete" > Delete mail user (DELETE)< / a > < / li >
< / ul >
< / li >
< li > < a href = "#mail-alias-aliasmail" > Mail Alias (/alias/< mail> )< / a > < ul >
< li > < a href = "#create-mail-alias-post" > Create mail alias (POST)< / a > < / li >
< li > < a href = "#delete-mail-alias-delete" > Delete mail alias (DELETE)< / a > < / li >
< / ul >
< / li >
< li > < a href = "#mailing-list-maillistmail-openldap-backend-only" > Mailing List (/maillist/< mail> , OpenLDAP backend only)< / a > < ul >
< li > < a href = "#create-mailing-list-post" > Create mailing list (POST)< / a > < / li >
< li > < a href = "#delete-mail-alias-delete_1" > Delete mail alias (DELETE)< / a > < / li >
2016-04-11 09:45:35 -05:00
< / ul >
< / li >
< / ul >
< / li >
< li > < a href = "#see-also" > See Also< / a > < / li >
< / ul >
< / li >
< / ul >
< / div >
2016-04-11 10:07:03 -05:00
< div class = "admonition note" >
< p class = "admonition-title" > Note< / p >
< p > If you need an API which has not yet been implemented, feel free to
< a href = "../contact.html" > contact us< / a > .< / p >
< / div >
2016-04-11 09:45:35 -05:00
< h2 id = "summary" > Summary< / h2 >
< p > iRedAdmin-Pro RESTful API will return message in JSON format.< / p >
< ul >
< li > If operation succeed, it returns JSON < code > {'success': true}< / code > .< / li >
< li > If operation failed, it returns JSON < code > {'success': false, 'msg': '< error_reason> '}< / code > .< / li >
< / ul >
< h2 id = "requirements" > Requirements< / h2 >
< ul >
< li > At least iRedAdmin-Pro-SQL-2.4.0 or iRedAdmin-Pro-LDAP-2.6.0. Earlier releases
didn't offer RESTful API.< / li >
< li > Our samples below requires tool < code > curl< / code > : < a href = "https://curl.haxx.se" > https://curl.haxx.se< / a > .< / li >
< / ul >
2016-04-11 22:29:47 -05:00
< h2 id = "samples" > Samples< / h2 >
< h3 id = "login-login-post" > Login (< code > /login< / code > , POST)< / h3 >
2016-04-11 09:45:35 -05:00
< pre > < code > curl -X POST -c cookie.txt -d " username=< username> & password=< password> " https://< server> /api/login
< / code > < / pre >
< ul >
< li > Replace < code > < username> < / code > by the real admin email address.< / li >
< li > Replace < code > < password> < / code > by the real admin password.< / li >
< li > It will create a plain text file < code > cookie.txt< / code > under current directory.< / li >
< / ul >
2016-04-11 22:29:47 -05:00
< h3 id = "domain-domaindomain" > Domain (< code > /domain/< domain> < / code > )< / h3 >
< h4 id = "create-domain-post" > Create domain (POST)< / h4 >
2016-04-11 09:45:35 -05:00
< pre > < code > curl -X POST -i -b cookie.txt -d " var=< value> & var2=value2" https://< server> /api/domain/< domain>
< / code > < / pre >
< ul >
< li > Replace < code > < domain> < / code > by the (new) real domain name.< / li >
< / ul >
< p > Optional POST data:< / p >
< ul >
< li > < code > cn< / code > : the short description of this domain name. e.g. company name.< / li >
< li > < code > quota< / code > : a integer number for mailbox quota (for whole domain)< / li >
< li > < code > preferredLanguage< / code > : default preferred language for new user. e.g. < code > en_US< / code > for English, < code > de_DE< / code > for Deutsch.< / li >
< li > < code > defaultQuota< / code > : default mailbox quota for new user.< / li >
< li > < code > maxUserQuota< / code > : Max mailbox quota of a single mail user< / li >
< li > < code > numberOfUsers< / code > : Max number of mail user accounts< / li >
< li > < code > numberOfAliases< / code > : Max number of mail alias accounts< / li >
< / ul >
2016-04-11 22:29:47 -05:00
< h4 id = "delete-domain-delete" > Delete domain (DELETE)< / h4 >
2016-04-11 09:45:35 -05:00
< pre > < code > curl -X DELETE -i -b cookie.txt https://< server> /api/domain/< domain>
< / code > < / pre >
< ul >
< li > Replace < code > < domain> < / code > by the (existing) domain name.< / li >
< / ul >
2016-04-11 22:29:47 -05:00
< h3 id = "mail-user-usermail" > Mail User (< code > /user/< mail> < / code > )< / h3 >
< h4 id = "create-mail-user-post" > Create mail user (POST)< / h4 >
2016-04-11 09:45:35 -05:00
< pre > < code > curl -X POST -i -b cookie.txt -d " var=value1& var2=value2& ..." https://< server> /api/user/< mail>
< / code > < / pre >
< ul >
< li > Replace < code > < mail> < / code > by the (new) email address.< / li >
< / ul >
< p > Required POST data:< / p >
< ul >
< li > < code > password< / code > : password for this user< / li >
< / ul >
< p > Optional POST data:< / p >
< ul >
< li > < code > cn< / code > : display name< / li >
< li > < code > preferredLanguage< / code > : default preferred language for new user. e.g. < code > en_US< / code > for English, < code > de_DE< / code > for Deutsch.< / li >
< li > < code > mailQuota< / code > : mailbox quota for this user (in MB). Defaults to per-domain quota setting or unlimited.< / li >
< / ul >
2016-04-11 22:29:47 -05:00
< h4 id = "delete-mail-user-delete" > Delete mail user (DELETE)< / h4 >
2016-04-11 09:45:35 -05:00
< pre > < code > curl -X DELETE -i -b cookie.txt https://< server> /api/user/< mail>
< / code > < / pre >
< ul >
< li > Replace < code > < mail> < / code > by the (existing) email address.< / li >
< / ul >
2016-04-11 22:29:47 -05:00
< h3 id = "mail-alias-aliasmail" > Mail Alias (< code > /alias/< mail> < / code > )< / h3 >
< h4 id = "create-mail-alias-post" > Create mail alias (POST)< / h4 >
< pre > < code > curl -X POST -i -b cookie.txt -d " ..." https://< server> /api/alias/< mail>
< / code > < / pre >
< ul >
< li > Replace < code > < mail> < / code > by the email address of (new) mail alias account.< / li >
< / ul >
< p > Optional POST data:< / p >
< ul >
< li > < code > cn< / code > : display name< / li >
< / ul >
< h4 id = "delete-mail-alias-delete" > Delete mail alias (DELETE)< / h4 >
< pre > < code > curl -X DELETE -i -b cookie.txt https://< server> /api/alias/< mail>
< / code > < / pre >
< ul >
< li > Replace < code > < mail> < / code > by the email address (existing) mail alias account.< / li >
< / ul >
< h3 id = "mailing-list-maillistmail-openldap-backend-only" > Mailing List (< code > /maillist/< mail> < / code > , OpenLDAP backend only)< / h3 >
< h4 id = "create-mailing-list-post" > Create mailing list (POST)< / h4 >
< pre > < code > curl -X POST -i -b cookie.txt -d " ..." https://< server> /api/maillist/< mail>
< / code > < / pre >
< ul >
< li > Replace < code > < mail> < / code > by the email address of (new) mailing list.< / li >
< / ul >
< p > Optional POST data:< / p >
< ul >
< li > < code > cn< / code > : display name< / li >
< / ul >
< h4 id = "delete-mail-alias-delete_1" > Delete mail alias (DELETE)< / h4 >
< pre > < code > curl -X DELETE -i -b cookie.txt https://< server> /api/maillist/< mail>
< / code > < / pre >
< ul >
< li > Replace < code > < mail> < / code > by the email address of (existing) mailing list.< / li >
< / ul >
2016-04-11 09:45:35 -05:00
< h2 id = "see-also" > See Also< / h2 >
< ul >
< li > < a href = "./iredadmin-pro.restful.api.python.html" > iRedAdmin-Pro RESTful API (interact with Python)< / a > < / li >
< / ul > < p style = "text-align: center; color: grey;" > All documents are available in < a href = "https://bitbucket.org/zhb/iredmail-docs/src" > BitBucket repository< / a > , and published under < a href = "http://creativecommons.org/licenses/by-nd/3.0/us/" target = "_blank" > Creative Commons< / a > license. If you found something wrong, please do < a href = "http://www.iredmail.org/contact.html" > contact us< / a > to fix it.< script >
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3293801-21', 'auto');
ga('send', 'pageview');
< / script >
< / body > < / html >