400来自twilio和x27的错误请求;使用TwilioRuby的RESTAPI

400来自twilio和x27的错误请求;使用TwilioRuby的RESTAPI,ruby,api,rest,twilio,Ruby,Api,Rest,Twilio,我试图使用rubygem开始使用Twilio的RESTAPI,但遇到了一个障碍。这是我的密码: h = {:From => "123-123-1234", :To => "123-123-1234", :Body => "hey"} account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN) resp = account.request("/#{API_VERSION}/Accounts/#{ACCOUNT_SID

我试图使用rubygem开始使用Twilio的RESTAPI,但遇到了一个障碍。这是我的密码:

h = {:From => "123-123-1234", :To => "123-123-1234", :Body => "hey"}
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request("/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages", 'POST', h)
这将提供以下输出:

warning: peer certificate won't be verified in this SSL session
=> #<Net::HTTPBadRequest 400 Bad Request readbody=true>
给出以下输出:

Net::HTTPBadResponse (wrong status line: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">"):
Net::HTTPBadResponse(错误的状态行:“”):

非常感谢您的帮助。

本应检查resp的主体:

<Message>The 'to' phone number provided is not yet verified for this account.  While your account is in Trial Mode, you may only send SMS messages to verified numbers.  Upgrade to a Full Twilio account to send to any phone number.</Message>
尚未验证此帐户提供的“收件人”电话号码。当您的帐户处于试用模式时,您只能向已验证的号码发送短信。升级到完整的Twilio帐户以发送到任何电话号码。

是的,在试用期间,您必须首先验证数字。升级并购买真实号码后,您可以发送到任何有效号码。如果您还有任何问题,请随时给我发电子邮件jsheehan@twilio.comI必须从你们那里买一个号码才能确认,对吗?
<Message>The 'to' phone number provided is not yet verified for this account.  While your account is in Trial Mode, you may only send SMS messages to verified numbers.  Upgrade to a Full Twilio account to send to any phone number.</Message>