• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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", "[email protected]", "-passwd", "XXXXX", "-mailbox", "true"]}'
{
    "code": 0,
    "stdout": "SUCCESS: Creation of mailname '[email protected]' 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", "[email protected]", "-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