I'am making a script that can create and sign Certificate on Mikrotik using their REST API.
The script already worked in creating the Certificate, the problem is, signing it.
In Mikrotik Command Line, signing a certificate requires Unnamed Parameter, which I don't know how to specify it in the REST API Request.
Here is the detail about the Commands that translates to the REST API Request:
- Creating A Certificate (Worked)
CMD:
/certificate add name=client-template-to-issue copy-from="client-template" common-name="$USERNAME@$CN"
REST:
URL: https://example.com/rest/certificate/add
Body: {
"common-name": "$USERNAME@$CN",
"name":"client-template-to-issue",
"copy-from":"client-template"
}
Response: {
"ret": "*14"
}
- Signing A Certificate (Diddnt Work)
CMD:
/certificate sign client-template-to-issue ca="$CN" name="$USERNAME@$CN"
REST:
URL: https://example.com/rest/certificate/sign
Body: {
"ca": "$CN",
"name":"$USERNAME@$CN"
}
Response: {
"detail": "failure: At least one field specifying certificate name must be set!",
"error": 400,
"message": "Bad Request"
}
So how do I fix this? the command line suggest that there is a Unnamed Parameter to specify for it to work. I already tried with the URL like this:
https://example.com/rest/certificate/sign/*14
and it still doesn't work.
The following worked for me:
I'm just not sure if this is a bug. Tested on ROS 7.7