protected CopyOrMoveRowResult postAndReceiveRowObject ( String path , CopyOrMoveRowDirective objectToPost ) throws SmartsheetException { Util . throwIfNull ( path , objectToPost ) ; Util . throwIfEmpty ( path ) ; HttpRequest request = createHttpRequest ( smartsheet . getBaseURI ( ) . resolve ( path ) , HttpMethod . POST ) ; ByteArrayOutputStream objectBytesStream = new ByteArrayOutputStream ( ) ; this . smartsheet . getJsonSerializer ( ) . serialize ( objectToPost , objectBytesStream ) ; HttpEntity entity = new HttpEntity ( ) ; entity . setContentType ( "application/json" ) ; entity . setContent ( new ByteArrayInputStream ( objectBytesStream . toByteArray ( ) ) ) ; entity . setContentLength ( objectBytesStream . size ( ) ) ; request . setEntity ( entity ) ; CopyOrMoveRowResult obj = null ; try { HttpResponse response = this . smartsheet . getHttpClient ( ) . request ( request ) ; switch ( response . getStatusCode ( ) ) { case 200 : obj = this . smartsheet . getJsonSerializer ( ) . deserializeCopyOrMoveRow ( response . getEntity ( ) . getContent ( ) ) ; break ; default : handleError ( response ) ; } } finally { smartsheet . getHttpClient ( ) . releaseConnection ( ) ; } return obj ; }
Post an object to Smartsheet REST API and receive a CopyOrMoveRowResult object from response .