Sameer Tamboli
Sameer Tamboli

Reputation: 41

Twillio - Requested resource Messages.json was not found

can anyone tell me how to resolve this problem. Java code is like below.

@Service
public class TwilioServiceProvider {
    private static final String ACCOUNT_SID = 
    "ACbfadc94adf90fd6606222566aab3ef4";
    private static final String AUTH_TOKEN = "f***********************";

    public void sendMessage(String mobileNo){
        Twilio.init(ACCOUNT_SID,AUTH_TOKEN);

        Message message = Message.creator(new PhoneNumber(mobileNo),new 
         PhoneNumber("+18325323857"),"Account validation 
         successfull").create();
        System.out.println(message.getAccountSid());

    }
}

I get the following error:

com.twilio.exception.ApiException: 
The requested resource /2010-04-01/Accounts/ACbfadc94adf90fd6606222566aab3ef4/Messages.json was not found

Upvotes: 4

Views: 10932

Answers (3)

shareef
shareef

Reputation: 9581

In my case, the reason is, empty from in the parameter...

As this image below, the exception URL is THIS but it does not say much.

debug preview

Exception as debugged preview

Upvotes: 0

philnash
philnash

Reputation: 73055

Twilio developer evangelist here.

If that is your real Account Sid in the code sample then that is where your problem lies. I just checked in our system and that Account Sid doesn't exist.

I'd double check your Account Sid in the Twilio console and try again, the code looks good otherwise.

Upvotes: 9

Zachary Craig
Zachary Craig

Reputation: 2220

What library are you using? It looks like it's trying to send a POST to

https://api.twilio.com/2010-04-01/2010-04-01/Accounts/ACbfadc94adf90fd6606222566aab3ef4/Messages.json

But, according to the twilio REST API Docs for the Messaging endpoints, it should be this:

https://api.twilio.com/2010-04-01/2010-04-01/Accounts/ACbfadc94adf90fd6606222566aab3ef4/Messages

But even that URL doesn't give me 401 unauthorized, it says 404, are you absolutely sure you have the correct account SID there?

Maybe try the official twilio Java SDK, or a newer version if you are using that?

Upvotes: 0

Related Questions