• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue Issue SSL cert via REST API

BenC

New Pleskian
Server operating system version
Windows
Plesk version and microupdate number
Version 18.0.55 Update #2
Hi,
I have been trying the REST API for creating/renewing certificates. I saw the useful article here https://support.plesk.com/hc/en-us/articles/12377059948183 I cant get the code to work, however i am making some assumptions that the files are meant to be on the computer making the curl request.

Bash:
curl -k -X POST -H "X-API-Key: ce8b9a38-4410-. . ." -H "Content-Type: application/json" -H "Accept: application/json" "https://<Server_IP>:8443/api/v2/cli/certificate/call" -d '{ "params": ["--create", "mynewcert", "-domain", "example.com", "-csr-file", "server.csr", "-key-file", "server.key"]}'

When I try the above (with the correct API key) I get the error

Bash:
"code": 1,
    "stdout": "",
    "stderr": "Unable to create certificate \"mynewcert\": file server.csr dose not exist"

The files are in the directory I am running the curl command from (linux machine). I have tried specifying the file as
Code:
server.csr
,
Code:
./server.csr
and
Code:
@server.csr

Are the files meant to be on the computer you are making the curl request from ? or are they meant to be on the server ?
If they are meant to be on the (windows) server , do you state the full file path e.g D:\certs\server.csr ? (I did try this as well , but got the same error.)
I have a feeling i am missing something obvious here.

Any help appreciated.

Kind Regards,
Ben
 
The files are meant to be on the same server you are running the command/api call on. The full path should be used for both the key and the csr file. Like for example D:\certs\server.csr.

For this particular API call, the call gets forwarded the CLI. To trouble shoot your issue you could try and see if are able to create/issue a certificate via CLI directly. See Plesk CLI documentation for Windows here.
 
Back
Top