Technical Tip: How to upload and assign a certificate to a policy using the REST API
Description
This article describes how to assign an uploaded certificate to a policy using the API.
Scope
FortiWeb and FortiWeb VM.
Solution
Upload the certificate by following the steps outlined in Technical Tip: How to upload the local certificate to FortiWeb using the REST API.

Apply it to the Policy using the REST API.
Use the following curl command:
curl --location --request PUT 'https://10.109.19.90/api/v2.0/cmdb/server-policy/policy?mkey=api-certificate' \
--header 'Authorization: xxx' \
--header 'Content-Type: application/json' \
--data '{"data":{"certificate":"server"}}'
In the above, mkey is the parameter, and api-certificate is the policy name.
