• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Issue REST API Plesk Unauthorized

whyicantgetin

New Pleskian
Hi,

I have issue on REST API Plesk, I already configure on panel.ini to enable API

Like this
[api]
enabled=on

For API keys I use this command: plesk bin secret_key -c -ip-address 203.0.xxx.xx

curl -k -X POST -H "X-API-Key: <API KEYS>" -H "Content-Type: application/json" -H "Accept: application/json" "https://<IP>:8443/api/v2/cli/mail/call" -d '{ "params": ["--create", "<EMAIL>, "-passwd", "<PSD>", "-mailbox", "true"]}'

I get unauthorized message when using cURL online. On Command Prompt, I got "curl: option -mailbox,: expected a proper numerical parameter" message...


I try run https://58.185.xxx.xxx:8443/api/v2/swagger.yml and get the data..

Can you help me? I want to create mail account with REST API.

Thank you
 
Last edited by a moderator:
Successfully tried with this method:

Code:
# curl -k -X POST --user admin:"XXXXX" -H "Content-Type: application/json" -H "Accept: application/json" -d"{}" "https://xxxxx-sites.plesk.space:8443/api/v2/auth/keys"
{
    "key": "f811322d-b8c0-ff5c-035c-cbbb6dd5xxx"
}You have new mail in /var/spool/mail/root



Code:
# curl -k -X POST -H "X-API-Key: f811322d-b8c0-ff5c-035c-cbbb6dd5xxx" -H "Content-Type: application/json" -H "Accept: application/json" "https://xxxxx-sites.plesk.space:8443/api/v2/cli/mail/call" -d '{ "params": ["--create", "jdoe@domain.su", "-passwd", "XXXXX", "-mailbox", "true"]}'
{
    "code": 0,
    "stdout": "SUCCESS: Creation of mailname 'jdoe@domain.su' complete",
    "stderr": ""
 
For
Code:
# curl -k -X POST --user admin:"XXXXX" -H "Content-Type: application/json" -H "Accept: application/json" -d"{}" "https://xxxxx-sites.plesk.space:8443/api/v2/auth/keys"

I run command 
[CODE]# plesk bin secret_key -c -ip-address <IP>
, isn't it same thing to get API keys? Right now I have account admin but not name admin


For
[CODE]# curl -k -X POST -H "X-API-Key: f811322d-b8c0-ff5c-035c-cbbb6dd5xxx" -H "Content-Type: application/json" -H "Accept: application/json" "https://xxxxx-sites.plesk.space:8443/api/v2/cli/mail/call" -d '{ "params": ["--create", "jdoe@domain.su", "-passwd", "XXXXX", "-mailbox", "true"]}'


Can I know where you test this ? I still get Unauthorized on web and "curl: option -mailbox,: expected a proper numerical parameter" on RDP...
 
I didn't have Linux... Is there any way/method that create Mail Account using REST API ? I need to create signing up email
 
I try this

curl -k -X POST -H "X-API-Key: <KEY>" “https://<IP>:8443/api/v2/cli/mail/call” -H “accept: application/json” -H “Content-Type: application/json” -d ‘{ “params”: [ “–help” ]}’

Result :
Invalid category provided, here is a list of all categories:

auth Different types of authentication methods
connection Low level networking operations
curl The command line tool itself
dns General DNS options
file FILE protocol options
ftp FTP protocol options
http HTTP and HTTPS protocol options
imap IMAP protocol options
misc Options that don't fit into any other category
output Filesystem output
pop3 POP3 protocol options
post HTTP Post specific options
proxy All options related to proxies
scp SCP protocol options
sftp SFTP protocol options
smtp SMTP protocol options
ssh SSH protocol options
telnet TELNET protocol options
tftp TFTP protocol options
tls All TLS/SSL related options
upload All options for uploads
verbose Options related to any kind of command line output of curl

Is mail not include on REST API anyomore ?
 
Back
Top