280 lines
7.2 KiB
HTML
280 lines
7.2 KiB
HTML
![]() |
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<title>iRedAdmin-Pro: RESTful API</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">iRedAdmin-Pro: RESTful API</h1>
|
||
|
<div class="toc">
|
||
|
<ul>
|
||
|
<li><a href="#iredadmin-pro-restful-api">iRedAdmin-Pro: RESTful API</a><ul>
|
||
|
<li><a href="#summary">Summary</a></li>
|
||
|
<li><a href="#requirements">Requirements</a></li>
|
||
|
<li><a href="#apis">APIs</a><ul>
|
||
|
<li><a href="#domain">Domain</a></li>
|
||
|
<li><a href="#user">User</a></li>
|
||
|
<li><a href="#mailing-list-openldap-only">Mailing List (OpenLDAP only)</a></li>
|
||
|
<li><a href="#mail-alias">Mail Alias</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li><a href="#sample-code-to-interact-with-iredadmin-pro-restful-api">Sample code to interact with iRedAdmin-Pro RESTful API</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="admonition note">
|
||
|
<p class="admonition-title">Note</p>
|
||
|
<p>If you need an API which has not yet been implemented, don't hesitate to
|
||
|
<a href="../contact.html">contact us</a>.</p>
|
||
|
</div>
|
||
|
<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>
|
||
|
</ul>
|
||
|
<h2 id="apis">APIs</h2>
|
||
|
<p>Notes:</p>
|
||
|
<ul>
|
||
|
<li>replace <code><domain></code> in URL by the real domain name.</li>
|
||
|
<li>replace <code><mail></code> in URL by the real email address.</li>
|
||
|
</ul>
|
||
|
<h3 id="domain">Domain</h3>
|
||
|
<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>URL</th>
|
||
|
<th>HTTP Method</th>
|
||
|
<th>Summary</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>/api/domain/<domain></td>
|
||
|
<td>POST</td>
|
||
|
<td>Create a new domin</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>/api/domain/<domain></td>
|
||
|
<td>DELETE</td>
|
||
|
<td>Delete an existing domain</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>/api/domain/<domain></td>
|
||
|
<td>PUT</td>
|
||
|
<td>Update profile of an existing domain</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>Possible <code>PUT</code> parameters used to update account profile:</p>
|
||
|
<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter Name</th>
|
||
|
<th>Summary</th>
|
||
|
<th>Sample Usage</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td><code>cn</code></td>
|
||
|
<td>the short description of this domain name. e.g. company name</td>
|
||
|
<td><code>cn=iRedMail Project</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><code>quota</code></td>
|
||
|
<td>a integer number for mailbox quota (for whole domain, in MB)</td>
|
||
|
<td><code>quota=20480</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><code>preferredLanguage</code></td>
|
||
|
<td>default preferred language for new user</td>
|
||
|
<td><code>preferredLanguage=en_US</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><code>defaultQuota</code></td>
|
||
|
<td>default mailbox quota for new user</td>
|
||
|
<td><code>defaultQuota=1024</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><code>maxUserQuota</code></td>
|
||
|
<td>Max mailbox quota of a single mail user</td>
|
||
|
<td><code>maxUserQuota=2048</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><code>numberOfUsers</code></td>
|
||
|
<td>Max number of mail user accounts</td>
|
||
|
<td><code>numberOfUsers=20</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><code>numberOfAliases</code></td>
|
||
|
<td>Max number of mail alias accounts</td>
|
||
|
<td><code>numberOfAliases=30</code></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<h3 id="user">User</h3>
|
||
|
<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>URL</th>
|
||
|
<th>HTTP Method</th>
|
||
|
<th>Summary</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>/api/user/<mail></td>
|
||
|
<td>POST</td>
|
||
|
<td>Create a new mail user</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>/api/user/<mail></td>
|
||
|
<td>DELETE</td>
|
||
|
<td>Delete an existing mail user</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>/api/user/<mail></td>
|
||
|
<td>PUT</td>
|
||
|
<td>Update profile of an existing mail user</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>Possible <code>PUT</code> parameters used to update account profile:</p>
|
||
|
<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter Name</th>
|
||
|
<th>Summary</th>
|
||
|
<th>Sample Usage</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td><code>cn</code></td>
|
||
|
<td>display name</td>
|
||
|
<td><code>cn=My New Name</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><code>preferredLanguage</code></td>
|
||
|
<td>default preferred language for new user</td>
|
||
|
<td><code>preferredLanguage=en_US</code></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><code>mailQuota</code></td>
|
||
|
<td>mailbox quota for this user (in MB)</td>
|
||
|
<td><code>mailQuota=1024</code></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<h3 id="mailing-list-openldap-only">Mailing List (OpenLDAP only)</h3>
|
||
|
<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>URL</th>
|
||
|
<th>HTTP Method</th>
|
||
|
<th>Summary</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>/api/maillist/<mail></td>
|
||
|
<td>POST</td>
|
||
|
<td>Create a new mailing list</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>/api/maillist/<mail></td>
|
||
|
<td>DELETE</td>
|
||
|
<td>Delete an existing mailing list</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>/api/maillist/<mail></td>
|
||
|
<td>PUT</td>
|
||
|
<td>Update profile of an existing mailing list</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>Possible <code>PUT</code> parameters used to update account profile:</p>
|
||
|
<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter Name</th>
|
||
|
<th>Summary</th>
|
||
|
<th>Sample Usage</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td><code>cn</code></td>
|
||
|
<td>display name</td>
|
||
|
<td><code>cn=My List Name</code></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<h3 id="mail-alias">Mail Alias</h3>
|
||
|
<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>URL</th>
|
||
|
<th>HTTP Method</th>
|
||
|
<th>Summary</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>/api/alias/<mail></td>
|
||
|
<td>POST</td>
|
||
|
<td>Create a new mail alias</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>/api/alias/<mail></td>
|
||
|
<td>DELETE</td>
|
||
|
<td>Delete an existing mail alias</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>/api/alias/<mail></td>
|
||
|
<td>PUT</td>
|
||
|
<td>Update profile of an existing mail alias</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>Possible <code>PUT</code> parameters used to update account profile:</p>
|
||
|
<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Parameter Name</th>
|
||
|
<th>Summary</th>
|
||
|
<th>Sample Usage</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td><code>cn</code></td>
|
||
|
<td>display name</td>
|
||
|
<td><code>cn=My List Name</code></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<h2 id="sample-code-to-interact-with-iredadmin-pro-restful-api">Sample code to interact with iRedAdmin-Pro RESTful API</h2>
|
||
|
<ul>
|
||
|
<li><a href="./iredadmin-pro.restful.api.curl.html">iRedAdmin-Pro RESTful API (interact with <code>curl</code>)</a></li>
|
||
|
<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>
|