Creating a Confluence page with the REST API - what format to use for the content?

I want to write some code that will use the REST API to create and maintain pages on Confluence Server entirely programmatically.

My question is how do I represent the content when I send it to the server? Do I use the storage format? If not, how do I specify the content?

Thanks.

Yes, storage format is required for creating content.
https://docs.atlassian.com/confluence/REST/latest/#content-createContent

I have a follow-up query … since storage format is required, I’ve set up a “template” page that I’m using as the foundation for how the page is laid out. I’m then getting my code to basically build a page with similar storage content.

However, when I try to save the page to Confluence, it produces this error:

Undeclared namespace prefix "ac"

This is because the start of the storage format for the template page looks like this:

<ac:layout><ac:layout-section ac:type="single"><ac:layout-cell>

Can I put anything at the start of the content to declare the namespace so that Confluence is happy?

http://www.amnet.net.au/~ghannington/confluence/readme.html suggests that I can add a bit to declare but adding the DOCTYPE line didn’t fix the error.

The error I’m getting back from Confluence seems to be related to updating an existing page rather then creating a new page. I don’t get an error when creating a page with entirely the same content, so I’m going to investigate that further and post a separate topic if I can’t resolve it.