Updated code to support the new API POST endpoint, also updated the code examples and optimsied the library code.