2021 Feb 14 12:00 PM - edited 2024 Feb 03 7:43 PM
Dears,
I'm trying to send SMS using Twilio SMS API from Hana XSJS. I have tested GET request from API, it's working as expected. But when I'm trying for POST, response code 301 MOVED PERMANENTLY. Below are the details.
@Thomas.jung , Need your help here.
User-Provided Instance
twilio.xsjs
var dest = $.net.http.readDestination("EXTERNAL_HTTP");
var client = new $.net.http.Client();
var req = new $.net.http.Request($.net.http.POST,"/Messages.json");
req.headers.set("Accept" , "application/json");
req.headers.set("Content-Type" , "application/x-www-form-urlencoded");
req.setBody("To=%2B919591439099&From=%2B12565619707&Body=+%0AJob");
client.request(req, dest);
console.log(req);
$.response.setBody(client.getResponse());
EXTERNAL_HTTP.xshttpdest
host = "api.twilio.com";
port = 443;
pathPrefix = "/2010-04-01/Accounts/<account_sid>";
proxyType = "http";
proxyHost = "proxy";
proxyPort = 8080;
authType = basic;
useSSL = false;
timeout = 0;
sslAuth = "anonymous";
Postman
Thanks in Advance.
Regards,
Irfan G.
Request clarification before answering.
You are getting a redirect (301) response because you are calling the HTTP endpoint of Twilio. You have to use the HTTPS endpoint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
33 | |
8 | |
8 | |
7 | |
7 | |
7 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.