Origin ca certificate generation

I am trying to create an origin certificate using curl command. In the command, the “csr” value should be a string. Is there any way we can pass that as some type?

Type as in?

The documentation on this is pretty clear

https://api.cloudflare.com/#origin-ca-create-certificate

It requires a JSON object, with a csr field which contains the CSR as string in its PEM format.

You can handle this within your code in whichever typed way you want, as long as the data you provide to the API in the request body follows aforementioned format. If your question is if you can provide something else, then no.

In the documentation it says the csr should be of string type and newline-encoded. I am running a pipeline that creates the .csr file, stores that into a variable as a string. So my question is can I pass that variable itself or it has to be plaintext?

Of course you can pass the variable

As already mentioned, you need to have a JSON object which follows that format. And yes, newlines need to be encoded as shown in the example.

And of course, whatever that variable contains, has to be plain text.

got it. thank you!

When I create my origin cert for my website, the “csr” block looks like this - “csr” : “echo $CSR”. $CSR contains the cert and is newline-encoded.

It seems as if your variable is not properly expanded, though that’s a language issue and best clarified at e.g. StackOverflow. Maybe try playing with the quotes.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.