[Solved] acmeclient api json

Started by jfqd, November 06, 2019, 06:25:02 PM

Previous topic - Next topic
November 06, 2019, 06:25:02 PM Last Edit: November 06, 2019, 06:56:08 PM by jfqd
Is there anywhere documented what the required json is to create a certificate with the acmeclient api?
Tried this, but it is failing:

curl -XPOST -H "Content-Type: application/json" -u "user:pass" \
  https://opnsense.example.com/api/acmeclient/certificates/add -d \
'{
  "certificate": {
    "enabled": "0",
    "name": "test.example.com",
    "altNames": "test2.example.com",
    "description": "test.example.com",
    "account": "example account",
    "validationMethod": "http-01 validation",
    "keyLength": "4096 bit",
    "autoRenewal": "1",
    "renewInterval": "60"
  }
}'

This worked for me, maybe it will help someone in the future:

curl -XPOST -H "Content-Type: application/json" -u "user:pass" \
  https://opnsense.example.com/api/acmeclient/certificates/add -d \
'{
  "certificate": {
    "enabled": "0",
    "name": "test.example.com",
    "altNames": "test2.example.com",
    "description": "test.example.com",
    "account": "uuid-of-the-account",
    "validationMethod": "uuid-of-the-validation-method",
    "keyLength": "key_4096",
    "autoRenewal": "1",
    "renewInterval": "60"
  }
}'