public static BoxLegalHoldAssignment . Info create ( BoxAPIConnection api , String policyID , String resourceType , String resourceID ) { URL url = ASSIGNMENTS_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , "POST" ) ; JsonObject requestJSON = new JsonObject ( ) . add ( "policy_id" , policyID ) . add ( "assign_to" , new JsonObject ( ) . add ( "type" , resourceType ) . add ( "id" , resourceID ) ) ; request . setBody ( requestJSON . toString ( ) ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject responseJSON = JsonObject . readFrom ( response . getJSON ( ) ) ; BoxLegalHoldAssignment createdAssignment = new BoxLegalHoldAssignment ( api , responseJSON . get ( "id" ) . asString ( ) ) ; return createdAssignment . new Info ( responseJSON ) ; }
Creates new legal hold policy assignment .