Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 3358773

Browse files
committed
Cloudflare CA CLI examples added
1 parent 3731c06 commit 3358773

2 files changed

Lines changed: 129 additions & 0 deletions

File tree

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,67 @@ $ cli4 /zones/:example.com/available_plans | jq -c '.[]|{"id":.id,"name":.name}'
549549
$
550550
```
551551

552+
### Cloudflare CA CLI examples
553+
554+
Here's some Cloudflare CA examples. Note the need of the zone_id= paramater with the basic **/certificates** call.
555+
556+
```bash
557+
$ cli4 /zones/:example.com | jq -c '.|{"id":.id,"name":.name}'
558+
{"id":"12345678901234567890123456789012","name":"example.com"}
559+
$
560+
561+
$ cli4 zone_id=12345678901234567890123456789012 /certificates | jq -c '.[]|{"id":.id,"expires_on":.expires_on,"hostnames":.hostnames,"certificate":.certificate}'
562+
{"id":"123456789012345678901234567890123456789012345678","expires_on":"2032-01-29 22:36:00 +0000 UTC","hostnames":["*.example.com","example.com"],"certificate":"-----BEGIN CERTIFICATE-----\n ... "}
563+
{"id":"123456789012345678901234567890123456789012345678","expires_on":"2032-01-28 23:23:00 +0000 UTC","hostnames":["*.example.com","example.com"],"certificate":"-----BEGIN CERTIFICATE-----\n ... "}
564+
{"id":"123456789012345678901234567890123456789012345678","expires_on":"2032-01-28 23:20:00 +0000 UTC","hostnames":["*.example.com","example.com"],"certificate":"-----BEGIN CERTIFICATE-----\n ... "}
565+
$
566+
```
567+
568+
A certificate can be viewed via a simple GET request.
569+
```bash
570+
$ cli4 /certificates/:123456789012345678901234567890123456789012345678
571+
{
572+
"certificate": "-----BEGIN CERTIFICATE-----\n ... ",
573+
"expires_on": "2032-01-29 22:36:00 +0000 UTC",
574+
"hostnames": [
575+
"*.example.com",
576+
"example.com"
577+
],
578+
"id": "123456789012345678901234567890123456789012345678",
579+
"request_type": "origin-rsa"
580+
}
581+
$
582+
```
583+
584+
Creating a certificate. This is done with a **POST** request. Note the use of **==** in order to pass a decimal number (vs. string) in JSON. The CSR is not shown for simplicity sake.
585+
```bash
586+
$ CSR=`cat example.com.csr`
587+
$ cli4 --post hostnames='["example.com","*.example.com"]' requested_validity==365 request_type="origin-ecc" csr="$CSR" /certificates
588+
{
589+
"certificate": "-----BEGIN CERTIFICATE-----\n ... ",
590+
"csr": "-----BEGIN CERTIFICATE REQUEST-----\n ... ",
591+
"expires_on": "2018-09-27 21:47:00 +0000 UTC",
592+
"hostnames": [
593+
"*.example.com",
594+
"example.com"
595+
],
596+
"id": "123456789012345678901234567890123456789012345678",
597+
"request_type": "origin-ecc",
598+
"requested_validity": 365
599+
}
600+
$
601+
```
602+
603+
Deleting a certificate can be done with a **DELETE** call.
604+
```bash
605+
$ cli4 --delete /certificates/:123456789012345678901234567890123456789012345678
606+
{
607+
"id": "123456789012345678901234567890123456789012345678",
608+
"revoked_at": "0000-00-00T00:00:00Z"
609+
}
610+
$
611+
```
612+
552613
### Paging CLI examples
553614

554615
The **--raw** command provides access to the paging returned values.

README.rst

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)