public BoxTaskAssignment . Info addAssignment ( BoxUser assignTo ) { JsonObject taskJSON = new JsonObject ( ) ; taskJSON . add ( "type" , "task" ) ; taskJSON . add ( "id" , this . getID ( ) ) ; JsonObject assignToJSON = new JsonObject ( ) ; assignToJSON . add ( "id" , assignTo . getID ( ) ) ; JsonObject requestJSON = new JsonObject ( ) ; requestJSON . add ( "task" , taskJSON ) ; requestJSON . add ( "assign_to" , assignToJSON ) ; URL url = ADD_TASK_ASSIGNMENT_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "POST" ) ; request . setBody ( requestJSON . toString ( ) ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject responseJSON = JsonObject . readFrom ( response . getJSON ( ) ) ; BoxTaskAssignment addedAssignment = new BoxTaskAssignment ( this . getAPI ( ) , responseJSON . get ( "id" ) . asString ( ) ) ; return addedAssignment . new Info ( responseJSON ) ; }
Adds a new assignment to this task .