public static final String ACCOUNT_SID = "ACxxx";
public static final String AUTH_TOKEN = "6xx";
public static void main(String[] args) {
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
Message message =
Message.creator(new PhoneNumber("+1518xx"), new PhoneNumber("+18xxx"),
"SMS POC").create();
System.out.println(message.getSid());
}
异常
Exception in thread "main" com.twilio.exception.ApiException: api.twilio.com
at com.twilio.http.NetworkHttpClient.makeRequest(NetworkHttpClient.java:88)
at com.twilio.http.HttpClient.reliableRequest(HttpClient.java:38)
at com.twilio.http.HttpClient.reliableRequest(HttpClient.java:22)
at com.twilio.http.TwilioRestClient.request(TwilioRestClient.java:42)
at com.twilio.rest.api.v2010.account.MessageCreator.create(MessageCreator.java:307)
at com.twilio.rest.api.v2010.account.MessageCreator.create(MessageCreator.java:25)
at com.twilio.base.Creator.create(Creator.java:45)
at com.twilio.notifications.config.TestMain.main(TestMain.java:18)
答案 0 :(得分:0)
在尝试快速启动示例时,我也遇到了这个问题。我确认我有正确的验证电话号码,文本没有空信息,代码正确指定了数字和数字。
我发现问题与代理有关。一旦在我的本地设置中修复它,它就像一个魅力。它在服务器中也没有任何问题。
希望这有帮助,
爱丽丝