I'd suggest having your code post to a web script (PUT), which in turn creates a content node and saves the text. If you do it in Java, I believe the FirstFoundationClientSDK SDK Sample has some code that shows how to create a new node and write some content. Your web script would receive two parameters- the space name (or id), and the html code to be written, which it sounds like you already have.