twilio-java icon indicating copy to clipboard operation
twilio-java copied to clipboard

com.twilio.exception.ApiConnectionException: Unable to deserialize response: Can not deserialize value of type java.net.URI from String

Open vteja11 opened this issue 5 years ago • 2 comments

Return the above exception

when using this code

import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    // DANGER! This is insecure. See http://twil.io/secure
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        ResourceSet<IncomingPhoneNumber> incomingPhoneNumbers =
            IncomingPhoneNumber.reader()
            .limit(20)
            .read();

        for(IncomingPhoneNumber record : incomingPhoneNumbers) {
            System.out.println(record.getSid());
        }
    }
}

Error details:

com.twilio.exception.ApiConnectionException: Unable to deserialize response: Can not deserialize value of type java.net.URI from String 
 "voice_url": "http://sb360.com/forward?PhoneNumber=208-209-3062&FailUrl=http://sb360.com/[email protected]&Message=Thanks for calling Jiseki. Please leave a message and%we will get back to you shortly.&Transcribe=true&",  is not a valid textual representation ,problem: Malformed escape pair at index 199```

vteja11 avatar Sep 09 '20 05:09 vteja11

Think we need a special deserializer that's able to URI-encode the returned URL which could contain spaces since we're attempting to represent it as a URI.

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

childish-sambino avatar Sep 15 '20 16:09 childish-sambino