Is there anything special with sending xml with an...
# sdf
m
Is there anything special with sending xml with an http request? I am trying to call Tableau, here is my code:
Copy code
var headers = {
        "Content-Type": "application/xml;charset=utf-8",
      };
      var response = <http://https.post|https.post>({
        url: "<https://tableau.server.com/api/3.4/auth/signin>",
        body:
          "<tsRequest>" +
          '<credentials name="name" password="password">' +
          '<site contentUrl="company"/>' +
          "</credentials>" +
          "</tsRequest>",
        headers: headers,
      });

      var resbody = response.body;

      log.audit({ title: "auth response", details: resbody });
b
probably the wrong channel, but usually you would want to use a tool like postman to make sure you know how to make your request work
then recreate it in code
i suspect postman will give the same error since the credentials element is not closed
m
Sorry for posting here, don't really know the difference between #C42JX79UZ and #C29HQS63G I used Insomnia with similar to postman, and jquery too, and both successed. That's what is weird about it. I think
credentials
is closed.
b
missed that it is closed
m
❤️
b
you will want to send the request to an echo server like httpbin.org
then compare the request it receives to the request you sent via insomnia
m
Wow, I didn't know this method. Thanks very much.
b
netsuite has defaults for some headers
m
Will check them.
@battk No kidding, how did you learn about echo servers? In college? I am a programmer from a long time and I never used them or read about them, which makes me feel very stupid now. And I thought I read a lot of stuff.
b
nothing special, i had a need to see what a request looked like
m
hmm, ok, thanks.