# Interact iRedAdmin-Pro RESTful API with `curl` !!! note * For more details about iRedAdmin-Pro RESTful API, please read document: [iRedAdmin-Pro: RESTful API](./iredadmin-pro.restful.api.html). * If you need an API which has not yet been implemented, don't hesitate to [contact us](https://www.iredmail.org/contact.html). Sample `curl` commands to interact iRedAdmin-Pro RESTful API. * replace `` in url by the real server address (hostname or IP) which runs iRedAdmin-Pro (with the `/iredadmin` prefix). for example, `https://my_domain.com/iredadmin`. * replace `` in url by the real domain name. * replace `` in url by the real email address. ``` # # Login # # It will create a plain text file `cookie.txt` under current directory. curl -X POST -c cookie.txt -d "username=&password=" https:///iredadmin/api/login # # Create domain (POST) # # cn=ABC Inc. (display name: "ABC Inc.") # quota=20480 (quota: 20 GB) curl -X POST -i -b cookie.txt -d "cn=ABC Inc."a=20480" https:///iredadmin/api/domain/ # # Create mail user (POST) # # cn=Zhang Huangbin (display name: "Zhang Huangbin") # mailQuota=1024 (mailbox quota: 1 GB) curl -X POST -i -b cookie.txt -d "password=A@StrongPassword2&cn=Zhang Huangbin&mailQuota=1024" https:///iredadmin/api/user/ # # Delete mail user (DELETE) # curl -X DELETE -i -b cookie.txt https:///iredadmin/api/user/ # # Update mail user profiles (PUT) # curl -X PUT -i -b cookie.txt -d "cn=John Smith&mailQuota=2048" https:///iredadmin/api/user/ # # Create mail alias (POST) # # cn=My Alias (display name: "My Alias") curl -X POST -i -b cookie.txt -d "cn=My Alias" https:///iredadmin/api/alias/ # # Delete mail alias (DELETE) # curl -X DELETE -i -b cookie.txt https:///iredadmin/api/alias/ # # Create mailing list (POST, OpenLDAP backend only) # curl -X POST -i -b cookie.txt -d "cn=My List" https:///iredadmin/api/maillist/ # # Delete mail alias (DELETE) # curl -X DELETE -i -b cookie.txt https:///iredadmin/api/maillist/ # # Delete domain (DELETE) # curl -X DELETE -i -b cookie.txt https:///iredadmin/api/domain/ ``` ## See Also * [Interact iRedAdmin-Pro RESTful API with Python](./iredadmin-pro.restful.api.python.html)