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();

exception=>

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库?这看起来像是2017年3月解决的问题。

我建议您升级您正在使用的Twilio Java库的版本,如果这不能解决问题,请在库回购中提出问题。

最新更新