I’m currently using a url printer for sms text, but I would like to get response codes. The ClickSend API needs specific headers. I found a few examples of this. using client.UploadString is giving me an error. If anyone has an idea that would be great.
Nevermind, I’m making it to hard on myself. Just used the helpers and it worked fine.
function send2() {
var url = "https://rest.clicksend.com/v3/sms/send";
var request = "{\"messages\": [ {\"body\":\"Test Message\",\"to\":\"+xxxxxxxxxxxxx\"} ] }";
var username = "username";
var password = "xxxxxxxxxxxxx";
var data = web.PostJson(url,request,username,password);
return data;
}
Thanks Memo. Thats great information. Looks like it was unauthorized. Thats odd that the authorization didn’t go through. I copied it directly from their site.
I used my actual credentials when using the helper. Either way, I really appreciate info like this.
thank you very much. it makes my job easier.
I have a question:
is it possible to output in some way only the code and the error message, to work with him later?
ex.
if (error code == 401) {
return “Please log in”
}