There's some short-hand (with error checking, I believe) versions of this and the below.. see createObject and createDatastream in:

https://github.com/futures/fcrepo4/blob/7592c0a946ba5b32d09df8ee771d99ebd2455dae/fcrepo-http-api/src/test/java/org/fcrepo/integration/http/api/AbstractResourceIT.java#L144