1

Topic: iRedAdmin pro - API not working

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.6.1 MARIADB edition
- Deployed with iRedMail Easy or the downloadable installer? downloadable installer
- Linux/BSD distribution name and version:  Linux Debian 11
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MYSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro?  YES
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,
Tries to import email accounts via the script import_users.py
In the /opt/www/iredadmin/settings.py configuration I added to the file:
ENABLE_RESTFUL_API = True
RESTFUL_API_CLIENTS = ['127.0.0.1']
and restarted the whole server to be sure.

Additionally, to run the script itself,
I have edited variables in import_users.py
api_endpoint = 'h t t p: // 127.0.0.1 : 8080/api'
verify_cert = False
admin = 'postmaster@ks12.pl'
pw = '12sd12fak12am'

Unfortunately, calling the script receives: "requests.exceptions.ConnectionError: HTTPConnectionPool (host = '127.0.0.1', port = 8080): Max retries exceeded with url: / api / login (Caused by NewConnectionError ('<urllib3.ection.HTTPConnection object at 0x7fa0c3a12f10>: Failed to establish a new connection: [Errno 111] Connect "

lsof also doesn't show something listening on port 8080
lsof -i -P -n | grep LISTEN | grep 8080

What am I doing wrong ?
Thank you in advance for your help !

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: iRedAdmin pro - API not working

przemeksw wrote:

api_endpoint = 'h t t p: // 127.0.0.1 : 8080/api'

What's your real URL to visit iRedAdmin-Pro? something like 'https://mail.example.com/iredadmin/'
The iRedAdmin-Pro API endpoint is the iRedAdmin-Pro URL plus '/api'. for example:
https://mail.example.com/iredadmin/api

3

Re: iRedAdmin pro - API not working

It seems that everything is fine, but for the API to work you need to run (issue a command) # python3 /opt/www/iredadmin/iredadmin.py &
At this point, it showed that the api was dry on the above-mentioned address and port and the script was executed. The question is why it does not work from the machine, but you need to manually fire it?

4

Re: iRedAdmin pro - API not working

przemeksw wrote:

The question is why it does not work from the machine, but you need to manually fire it?

Seems you didn't get my point.

iRedAdmin-Pro runs on URL https://<your-server.com>/iredadmin/ by default, and restful API is https://<your-server.com/iredadmin/api. There's no port 8080 at all.

You should update "api_endpoint =" parameter to use the valid URL.

5

Re: iRedAdmin pro - API not working

Ok - everything works as you wrote!
In that case, please replace the "api_endpoint =" suggestions in the import_users.py file and also, maybe mention it somewhere in the documentation, because honestly I haven't seen it anywhere, but I was looking for it smile