The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Error trying to use installssl API

Discussion in 'cPanel Developers' started by GamingX, Jun 19, 2013.

  1. GamingX

    GamingX Member

    Joined:
    Feb 9, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hello again,

    I've been trying to use the installssl API to install SSL certificates through a script, but I'm having trouble using the API to do it. It keeps throwing me errors when I try to use it. It either says that "The certificate appears to be invalid" or "A certificate and private key must be provided." when I'm doing everything right or presume to be. I've tried installing the certificate by logging in through WHM and installing it and it works fine then. This is the API I'm trying to use:

    https://example.com:2087/json-api/i...xample.com&cert=certificate_data&key=key_data &cab=certificate_authority_bundle&ip=192.168.0.1

    https://example.com:2087/json-api/installssl?ser=username&domain=example.com&cert=---Begin Certificate------End Certificate---&key=---Begin RSA Private Key-----END RSA Private Key--- &cab=---Begin Certificate------End Certificate&ip=192.168.0.1

    I get the "A certificate and private key must be provided." error for the above syntax, however if I trim all the spaces within the certificates, I get the Invalid error. Is there something that I'm missing ?

    Thank you.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,687
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. GamingX

    GamingX Member

    Joined:
    Feb 9, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    The cPanel version is 11.38
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,687
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Are you entering the URL directly in your web browser, or are you using a script on the server? Feel free to open a support ticket and we can attempt to reproduce this behavior with the actual CRT/Key that you are using. You can post the ticket number here and we can update this thread with the outcome.

    Thank you.
     
  5. cPAndrewHodge

    cPAndrewHodge cPanel UI Developer
    Staff Member

    Joined:
    Dec 10, 2012
    Messages:
    52
    Likes Received:
    3
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    From the example you've provided, it looks like you'll need to URI encode the key and certificate before your example would work. You can use a site like Url Encode/Decode online to do the encoding.
     
Loading...

Share This Page