How do I post a large HTML formatted page to Confluence using the REST API?

In the example found here, they use a simple <p></p> tag to post a single string of text. My script will need to post a large amount of data into a template. I have the HTML source file of the template, but I get a massive error log when I try and post it all in place of the <p>This is a new page</p> tag. Is there a way to create a new confluence page using an HTML source file as a template?


Well, what error? We cant help much without.