public static BoxStoragePolicyAssignment . Info create ( BoxAPIConnection api , String policyID , String userID ) { URL url = STORAGE_POLICY_ASSIGNMENT_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , HttpMethod . POST ) ; JsonObject requestJSON = new JsonObject ( ) . add ( "storage_policy" , new JsonObject ( ) . add ( "type" , "storage_policy" ) . add ( "id" , policyID ) ) . add ( "assigned_to" , new JsonObject ( ) . add ( "type" , "user" ) . add ( "id" , userID ) ) ; request . setBody ( requestJSON . toString ( ) ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject responseJSON = JsonObject . readFrom ( response . getJSON ( ) ) ; BoxStoragePolicyAssignment storagePolicyAssignment = new BoxStoragePolicyAssignment ( api , responseJSON . get ( "id" ) . asString ( ) ) ; return storagePolicyAssignment . new Info ( responseJSON ) ; }
Create a BoxStoragePolicyAssignment for a BoxStoragePolicy .