OPNsense Forum

Archive => 19.7 Legacy Series => Topic started by: jfqd on November 06, 2019, 06:25:02 PM

Title: [Solved] acmeclient api json
Post by: jfqd on November 06, 2019, 06:25:02 PM
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"
  }
}'
Title: Re: acmeclient api json
Post by: jfqd on November 06, 2019, 06:55:37 PM
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"
  }
}'