https://{Account_SID}:{Token}@api.twilio.com/2010-04-01/Accounts/{Acount_SID}/SMS/Messages.json
It is working fine with POSTMAN. But i am not able to get response with this networking library.
How can fix it?
can you tell me the exact code? That will help me to serve you better.
Yes here is my code.
JSONObject param = new JSONObject();
try {
param.put("From", fromNo);
param.put("To", toNo);
param.put("Body", getString(R.string.receiveSMS) + verifyNumber);
} catch (JSONException e) {
e.printStackTrace();
}
AndroidNetworking.post("https://" + getString(R.string.twilio_account_sid) + ":" + getString(R.string.twilio_token) + "@api.twilio.com/2010-04-01/Accounts/" + getString(R.string.twilio_account_sid) + "/SMS/Messages.json")
.addJSONObjectBody(param)
.build()
.getAsJSONObject(new JSONObjectRequestListener() {
@Override
public void onResponse(JSONObject response) {
Log.d("logs", "Response : " + response.toString());
}
@Override
public void onError(ANError anError) {
Log.d("logs", "Error : " + anError.toString());
}
});
well twilio token number and account sid is correct. It's working fine with POSTMAN
what error you are getting -> anError.toString()
com.androidnetworking.error.ANError
error.getDetail()?
responseFromServerError
check for error.getErrorBody() and errorCode
{"code": 20003, "detail": "Your AccountSid or AuthToken was incorrect.", "message": "Authentication Error - No credentials provided", "more_info": "https://www.twilio.com/docs/errors/20003", "status": 401} 401
Oh i am using the same url with postman. but it works fine.
You can use pathParamter also. Refer link
there may be case that the URL is not building correctly. Check for that.
same issue with using pathParameter.
and URL is correct. I've checked several times and copy the link and paste it in postman.
The request is get or post?
post
What information do you need? Plz tell me exactly.
Account SID, Token number, From phone no. Do you need these informations?
only the things required in URL
Just sent detailed informations to your gmail
Checking
Ok thanks
I have mailed you the solution
Oh let me see. Just mins
Yep it works. Thanks very much. I can see my fault.
can you please send me that code .I am facing the same issue.

@ayushdimri
Most helpful comment
Yep it works. Thanks very much. I can see my fault.