微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

twilio phoneNUMber 定价 api 抛出异常

如何解决twilio phoneNUMber 定价 api 抛出异常

https://pricing.twilio.com/v1/PhoneNumbers/Countries/{countryCode}

API 正在获取国家/地区并给出类似的响应

预期响应 =>

{
    "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/US","country": "United States","price_unit": "USD","phone_number_prices": [
        {
            "number_type": "local","base_price": "1.00","current_price": "1.00"
        },{
            "number_type": "toll free","base_price": "2.00","current_price": "2.00"
        }
    ],"iso_country": "US"
}

但是我在获取国家/地区时遇到问题,它会给出异常

Country country= Country.fetcher(countryCode).fetch();

异常=>

Unrecognized field "number_type" (class com.twilio.type.PhoneNumberPrice),not marked as ignorable (5 kNown properties: "basePrice","type","base_price","currentPrice","current_price"])
 at [Source: (org.apache.http.conn.EofSensorInputStream); line: 1,column: 212] (through reference chain: com.twilio.rest.pricing.v1.phonenumber.Country["phone_number_prices"]-
>java.util.ArrayList[0]->com.twilio.type.PhoneNumberPrice["number_type"])

如何解决这个问题

解决方法

这里是 Twilio 开发者布道者。

您使用的是哪个版本的 Twilio Java 库?这看起来像 an issue that was fixed back in March 2017

我建议您升级您正在使用的 Twilio Java 库的版本,如果这不能解决问题,请提出 an issue on the library repo

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。