@ Override public void updateState ( final String assetId , final StateAction action ) throws IOException , RequestFailureException { StateUpdateAction newState = new StateUpdateAction ( action ) ; HttpURLConnection connection = createHttpURLConnectionToMassive ( "/assets/" + assetId + "/state" ) ; connection . setRequestMethod ( "PUT" ) ; connection . setRequestProperty ( "Content-Type" , "application/json" ) ; connection . setDoOutput ( true ) ; JSONAssetConverter . writeValue ( connection . getOutputStream ( ) , newState ) ; // Make sure it was ok testResponseCode ( connection , true ) ; }
This method will update the state of an object by taking the supplied action .