REST API GET/POST calls within Switch workflow via "Script Element"

Post Reply
micahtds
Newbie
Posts: 1
Joined: Wed Nov 22, 2023 4:29 pm

REST API GET/POST calls within Switch workflow via "Script Element"

Post by micahtds »

Hello,

I am currently working on a project which requires calling an external System via REST API GET/POST calls. We currently have multiple SwitchScriptTool projects (using Visual Code) which utilize Axios HTTP request module. We are able to GET and POST within the Projects using Axios.

My question for the community:

How can we use the JS scripts produced by the Transpile function within a Switch Workflow (Script Element)? Has anyone successfully achieved this? If so, what modules were used?

Thanks in advance for any information provided.
Micah
User avatar
foxpalace
Member
Posts: 33
Joined: Fri Jan 14, 2011 12:25 pm
Location: Germany

Re: REST API GET/POST calls within Switch workflow via "Script Element"

Post by foxpalace »

Hi,
so really I don't know what you mean, this?
https://www.enfocus.com/en/learn/switch#scripting
I use in very much Scripts axios for API-Calls

Michael
freddyp
Advanced member
Posts: 1002
Joined: Thu Feb 09, 2012 3:53 pm

Re: REST API GET/POST calls within Switch workflow via "Script Element"

Post by freddyp »

In a script element you point to an .sscript file, not to a JS file. Either that file is in a script folder with a size of 0 bytes. Or it is a packed script file in which case it has a certain size and it is a standalone package. You can pack the script folder using the SwitchScriptTool (run the tool without options to see the help, or read the documentation or watch the videos in the Learn section of our site).

The recommended practice is: use script folders during the development and use packed scripts in production.
Post Reply