import com.messagebird.MessageBirdClient; import com.messagebird.MessageBirdService; import com.messagebird.MessageBirdServiceImpl; import com.messagebird.exceptions.GeneralException; import com.messagebird.exceptions.UnauthorizedException; import com.messagebird.exceptions.NotFoundException; public class ExampleCancelNumber { public static void main(String[] args) { if (args.length < 2) { System.out.println("Please specify your access key & the number you wish to delete."); return; } // First create your service object final MessageBirdService wsr = new MessageBirdServiceImpl(args[0]); // Add the service to the client final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr); try { messageBirdClient.cancelNumber(args[1]); System.out.println("Number Deleted!"); } catch (UnauthorizedException | GeneralException | NotFoundException exception) { if (exception.getErrors() != null) { System.out.println(exception.getErrors().toString()); } exception.printStackTrace(); } } }