Certificate signing requests

Certificate signing requests generated on the appliance, for a certificate authority to sign.

Certificate signing requests

GET /certificates/csrs

Get All Certificate Signing Requests

curl
curl -X GET "https://appliance.example.com/api/v1/certificates/csrs" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/certificates/csrs", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Response
{
  "status": "success",
  "uid": "df9-b60-96e-3c8",
  "message": "Certificate Signing Requests",
  "data": {
    "aae-45a-08e-958": {
      "name": "Management",
      "certInfo": {
        "commonName": "loadbalancer.localdomain",
        "organisation": "loadbalancer.org",
        "country": "US",
        "subjectAlt": []
      },
      "keyLength": 4069,
      "signatureAlgorithm": "sha256",
      "days": 730,
      "linkCertId": "e15-36c-3ce-8c5"
    }
  }
}

POST /certificates/csrs

Add a Certificate Signing Request

This change is staged. Send PUT /services/apply to apply it.

Body parameters
name string Required
certInfo array Required
keyLength integer Required
signatureAlgorithm string Required
curl
curl -X POST "https://appliance.example.com/api/v1/certificates/csrs" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "<name>",
  "certInfo": [
    "<certInfo>"
  ],
  "keyLength": 0,
  "signatureAlgorithm": "<signatureAlgorithm>"
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'name' => '<name>',
    'certInfo' => [
        '<certInfo>',
    ],
    'keyLength' => 0,
    'signatureAlgorithm' => '<signatureAlgorithm>',
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "name": "<name>",
    "certInfo": [
        "<certInfo>"
    ],
    "keyLength": 0,
    "signatureAlgorithm": "<signatureAlgorithm>"
}

response = requests.post("https://appliance.example.com/api/v1/certificates/csrs", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "name": "<name>",
  "certInfo": [
    "<certInfo>"
  ],
  "keyLength": 0,
  "signatureAlgorithm": "<signatureAlgorithm>"
}),
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "New Certificate Signing Request: {name} successfully added",
  "data": {
    "id": "4e8-2c3-b53-1f7"
  }
}

By ID

GET /certificates/csrs/{id}

Get Certificate Signing Request by ID

Path parameters
id string Required
curl
curl -X GET "https://appliance.example.com/api/v1/certificates/csrs/{id}" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/certificates/csrs/{id}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Response
{
  "status": "success",
  "uid": "c0b-7e6-583-1c1",
  "message": "Certificate Signing Request",
  "data": {
    "id": "4e8-2c3-b53-1f7",
    "name": "Generate CSR",
    "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIIDDjCCAfYCBFRlc3QxETI8W/WJYA4IB\nAQBmbMCCXRyZkBD8IK5M.......TEakhwTJ+wtAdBCL8m7ckN6on5kxnyyLQ8PgYNybRaYe\n8qVkXGlS89INYMOPvycHxAB\n-----END CERTIFICATE REQUEST-----\n",
    "privateKey": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwvtd4Z99htbLYwHi5g477.......uFXxB1rEBJ8MVwcmpFG89UrEtcFvua1oQgACgiE8\nARf4qXSTPDd+DclQgde88OU=\n-----END PRIVATE KEY-----\n",
    "certInfo": {
      "commonName": "test.com",
      "organisation": "Test",
      "organisationalUnit": "Test",
      "locality": "Test",
      "state": "Test",
      "country": "GB",
      "email": "test@test.com",
      "subjectAlt": [
        "www.test.com"
      ]
    },
    "keyLength": 2048,
    "signatureAlgorithm": "sha256",
    "selfSigned": true,
    "days": 365,
    "linkCertId": ""
  }
}

PUT /certificates/csrs/{id}

Edit a Certificate Signing Request

This change is staged. Send PUT /services/apply to apply it.

Path parameters
id string Required

The id of the csr.

Body parameters
name string Required
selfSigned boolean Required
certInfo array Required
keyLength integer Required
signatureAlgorithm string Required
curl
curl -X PUT "https://appliance.example.com/api/v1/certificates/csrs/{id}" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "<name>",
  "selfSigned": true,
  "certInfo": [
    "<certInfo>"
  ],
  "keyLength": 0,
  "signatureAlgorithm": "<signatureAlgorithm>"
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'name' => '<name>',
    'selfSigned' => true,
    'certInfo' => [
        '<certInfo>',
    ],
    'keyLength' => 0,
    'signatureAlgorithm' => '<signatureAlgorithm>',
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "name": "<name>",
    "selfSigned": true,
    "certInfo": [
        "<certInfo>"
    ],
    "keyLength": 0,
    "signatureAlgorithm": "<signatureAlgorithm>"
}

response = requests.put("https://appliance.example.com/api/v1/certificates/csrs/{id}", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "name": "<name>",
  "selfSigned": true,
  "certInfo": [
    "<certInfo>"
  ],
  "keyLength": 0,
  "signatureAlgorithm": "<signatureAlgorithm>"
}),
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Certificate Signing Request has been updated successfully"
}

DELETE /certificates/csrs/{id}

Delete Certificate Signing Request by ID

This change is staged. Send PUT /services/apply to apply it.

Path parameters
id string Required
curl
curl -X DELETE "https://appliance.example.com/api/v1/certificates/csrs/{id}" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.delete("https://appliance.example.com/api/v1/certificates/csrs/{id}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Certificate Signing Request has been deleted"
}

Apply a signed certificate to a signing request

PUT /certificates/csrs/{id}/apply

Apply cart to csr.

Path parameters
id string Required
curl
curl -X PUT "https://appliance.example.com/api/v1/certificates/csrs/{id}/apply" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}/apply';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.put("https://appliance.example.com/api/v1/certificates/csrs/{id}/apply", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}/apply', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Successfully apply cert from CSR"
}

Renew a self-signed certificate

PUT /certificates/csrs/{id}/renew

Renew a self signed Certificate

This change is staged. Send PUT /services/apply to apply it.

Path parameters
id string Required
curl
curl -X PUT "https://appliance.example.com/api/v1/certificates/csrs/{id}/renew" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}/renew';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.put("https://appliance.example.com/api/v1/certificates/csrs/{id}/renew", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}/renew', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Successfully renewed the self signed certificate with id {id}"
}