SSL certificate mutation examples

All SSL certificates must be connected to at least one domain.

A new SSL certificate should always contain three fields: certificate, chain and private key. An existing SSL certificate can have empty fields (certificate, chain and private key). In this case the empty fields will remain unchanged.

When certificate , chain or private key is left empty and delete flag is set to false the API should trow an exception. If the delete flag is set to true the SSL certificate should be deleted entirely with all its additional domains.

Add / change ssl certificate

For all add / change examples we use the same CreateSslCertificate query:

mutation CreateSslCertificate($sslCertificate: SslCertificateInput!) {
    SslCertificate(entity: $sslCertificate, delete: false) {
        id
        certificate
        chain
        privateKey
        domain
        __typename
        alternativeDomains {
            alternativeDomain
        }
        connectedDomains {
            id
        }
        connectedDomainPointers {
            id
        }
    }
}

New SslCertificate

var variables = {
    "sslCertificate": {
        "certificate": "<certificate>",
        "chain": "<chain>",
        "privateKey": "<privateKey>"
    }
}

Existing SslCertificate to domain

var variables = {
    "sslCertificate": {
        "id": 1234,
        "domainId": 456
    }
}

Change SslCertificate without changing domain connections

var variables = {
    "sslCertificate": {
        "id": 1234,
        "certificate": "<new_certificate>"
    }
}

Change chain without changing domain connections

var variables = {
    "sslCertificate": {
        "id": 1234,
        "chain": "<new_chain>"
    }
}

Change private key without changing domain connections

var variables = {
    "sslCertificate": {
        "id": 1234,
        "privateKey": "<new_privateKey>"
    }
}

Delete SslCertificate

For all delete examples we use the SslCertificate query:

mutation DeleteSslCertificate($sslCertificate: SslCertificateInput!) {
    SslCertificate(entity: $sslCertificate, delete: true) {
        id
        __typename
    }
}

Delete single SslCertificate

var variables = {
    "SslCertificate": {
        "id": 1234,
        "domainId": 456
    }
}

Delete SslCertificate from all domains / alternative domains

var variables = {
    "SslCertificate": {
        "id": 1234
    }
}