@@ -610,6 +610,74 @@ A somewhat useful listing of available plans for a specific zone.
610610 {" id" :" 0feeeeeeeeeeeeeeeeeeeeeeeeeeeeee" ," name" :" Free Website" }
611611 $
612612
613+ Cloudflare CA CLI examples
614+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
615+
616+ Here's some Cloudflare CA examples. Note the need of the zone\_ id=
617+ paramater with the basic **/certificates ** call.
618+
619+ .. code :: bash
620+
621+ $ cli4 /zones/:example.com | jq -c ' .|{"id":.id,"name":.name}'
622+ {" id" :" 12345678901234567890123456789012" ," name" :" example.com" }
623+ $
624+
625+ $ cli4 zone_id=12345678901234567890123456789012 /certificates | jq -c ' .[]|{"id":.id,"expires_on":.expires_on,"hostnames":.hostnames,"certificate":.certificate}'
626+ {" id" :" 123456789012345678901234567890123456789012345678" ," expires_on" :" 2032-01-29 22:36:00 +0000 UTC" ," hostnames" :[" *.example.com" ," example.com" ]," certificate" :" -----BEGIN CERTIFICATE-----\n ... " }
627+ {" id" :" 123456789012345678901234567890123456789012345678" ," expires_on" :" 2032-01-28 23:23:00 +0000 UTC" ," hostnames" :[" *.example.com" ," example.com" ]," certificate" :" -----BEGIN CERTIFICATE-----\n ... " }
628+ {" id" :" 123456789012345678901234567890123456789012345678" ," expires_on" :" 2032-01-28 23:20:00 +0000 UTC" ," hostnames" :[" *.example.com" ," example.com" ]," certificate" :" -----BEGIN CERTIFICATE-----\n ... " }
629+ $
630+
631+ A certificate can be viewed via a simple GET request.
632+
633+ .. code :: bash
634+
635+ $ cli4 /certificates/:123456789012345678901234567890123456789012345678
636+ {
637+ " certificate" : " -----BEGIN CERTIFICATE-----\n ... " ,
638+ " expires_on" : " 2032-01-29 22:36:00 +0000 UTC" ,
639+ " hostnames" : [
640+ " *.example.com" ,
641+ " example.com"
642+ ],
643+ " id" : " 123456789012345678901234567890123456789012345678" ,
644+ " request_type" : " origin-rsa"
645+ }
646+ $
647+
648+ Creating a certificate. This is done with a **POST ** request. Note the
649+ use of **== ** in order to pass a decimal number (vs. string) in JSON.
650+ The CSR is not shown for simplicity sake.
651+
652+ .. code :: bash
653+
654+ $ CSR=` cat example.com.csr`
655+ $ cli4 --post hostnames=' ["example.com","*.example.com"]' requested_validity==365 request_type=" origin-ecc" csr=" $CSR " /certificates
656+ {
657+ " certificate" : " -----BEGIN CERTIFICATE-----\n ... " ,
658+ " csr" : " -----BEGIN CERTIFICATE REQUEST-----\n ... " ,
659+ " expires_on" : " 2018-09-27 21:47:00 +0000 UTC" ,
660+ " hostnames" : [
661+ " *.example.com" ,
662+ " example.com"
663+ ],
664+ " id" : " 123456789012345678901234567890123456789012345678" ,
665+ " request_type" : " origin-ecc" ,
666+ " requested_validity" : 365
667+ }
668+ $
669+
670+ Deleting a certificate can be done with a **DELETE ** call.
671+
672+ .. code :: bash
673+
674+ $ cli4 --delete /certificates/:123456789012345678901234567890123456789012345678
675+ {
676+ " id" : " 123456789012345678901234567890123456789012345678" ,
677+ " revoked_at" : " 0000-00-00T00:00:00Z"
678+ }
679+ $
680+
613681 Paging CLI examples
614682~~~~~~~~~~~~~~~~~~~
615683
0 commit comments