IPaaS JavaScript Not Working
Please see below. I have a use case where I need to connect to a system (KickServ) that only uses XML, so I need to write JavaScript to connect to the endpoint and process the XML data. However, as seen below, I have a JavaScript that only uses standard JavaScript. I get a warning that the Async functions are not available in the current version supported by IPaaS. Is there a way to get around this? In addition, the script does not recognize the BTOA function, a standard JavaScript function.
https://app.screencast.com/nncN9KkKrc8x2
Any pointers would be appreciated.
Tevis
Answers (3)
Is your token value persistent? If so, then you can set it up as part of the credentials using the "API with Authorization Header" type authentication method.
My problem was that the token was temporary and dynamic with the application I was working with, and the authorization header was mildly non-standard. Yours looks more standard, and there should be a cookbook for this that matches. Look at Step 2 on this article https://solutions.teamdynamix.com/TDClient/1965/Portal/KB/ArticleDet?ID=142165& for example.
My login (authentication) method was sending a username and password to get the authorization back in a JSON object, which I extracted and passed to my custom connector where the action (see earlier screenshot) included it as a header as part of the action definition.
It all seems a bit bonkers to me, but I've not found a good description of how these pieces fit together, and support was only mildly helpful. When I look at the article above, I can't help thinking that I probably screwed up and didn't solve the problem the right way.
p.s. I'm not with TDX. I'm just someone who had a similar problem and struggled mightily. I've posted this question in the Slack, but no-one has bitten on it yet!
https://app.screencast.com/DN4eV7nAHLTOv
Tevis - Tevis Boulware Fri 6/28/24 1:55 PM
https://app.screencast.com/QTPrUpdv8zzkO
Can you point me in the right direction?
Thanks, Tevis - Tevis Boulware Mon 7/1/24 7:16 PM
When I pass the response to the subflow, and I copy and paste the response to the data model of the subflow, the subflow recognizes it as XML.
I am getting closer. There are only a few more hurdles to cross before I have everything I need to fully develop the use case.
Tevis - Tevis Boulware Tue 7/2/24 6:47 PM
My recollection of the data model process is that if you have a relatively complex structure, you have to start at the bottom of the tree and build the elements of the lowest parent, then add that object to it's parent, etc., e.g.
someObject
- child prop
- child object
-- child object prop
-- child object prop
You'd built "child object" first adding the child object properties, then build "someObject" and add "child obj" and "child object" to it. - David Tod Wed 7/3/24 9:47 AM
Now you're getting into areas that make my head hurt! You may have to experiment a bit and see what headers get sent and received. I had to create a custom connector relatively recently where the Authorization header used
'Authorization': 'BamAuthToken ....etc'
which I did by adding a header to methods (see image), but that might be my not understanding Authentication methods. Looking at other connectors, I'm a bit mystified to be honest. I'm not sure how other connectors do it, but they must. The more I look at Authentication methods, the less sense they make, since it's not clear how you get from an Authentication method to an Authorization header.
Can't you just use a generic HTTP connector?
The Kickserv endpoint requires a token be passed with every call, and this is the header I use in my script:
headers: {
'Accept': 'application/xml',
'Content-Type': 'application/xml',
'Authorization': `Basic ${encodedToken}`
}
Which of the available authentication methods do you suggest?
Thanks, Tevis - Tevis Boulware Fri 6/28/24 10:51 AM
https://app.screencast.com/wy1hEF2ELkQ5V
I suspect I am missing something, but I can't quite put my finger on it.
Tevis - Tevis Boulware Fri 6/28/24 12:46 PM
If necessary, I would like to meet with anyone on the TDX side who can help me with the low-level details, such as how to make a custom connector and add methods and parameter strings. If this effort fails, TeamDynamix will lose quite a bit of support from our automation team.
I don't have any problems with the "logic" or algorithms, but the low-level details are holding me back.
Thanks, Tevis - Tevis Boulware Fri 6/28/24 1:11 PM
If it's not static and you need to refresh tokens, it's still possible but I'd have to research some more. - Steven Applegarth Fri 6/28/24 5:14 PM
https://app.screencast.com/87ydTnK50qhs9
Any ideas?
Thanks, Tevis - Tevis Boulware Mon 7/1/24 12:27 PM