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
3
Answers
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?
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.
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.