Query an API for XML Job Ticket
Query an API for XML Job Ticket
I have created an API and was hoping to use switch to query the API to get the jobticket information. I have setup so that when the job ticket id is sent to the API a XML file is created and then saved into an input folder but I cannot get the script to query the API. My Javascript is not very good and the only examples I could find was to use document.location.href = but at this point I cannot get it to work. Any Ideas?
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Query an API for XML Job Ticket
Is your API a web services, eg. SOAP, command-line app or script?
Query an API for XML Job Ticket
document.location.href is a typical code snippet from Javascript used in a browser environment. Anything you find on Javascript for browsers is useless in a Switch context. Use the scripting reference in the Switch help instead. You will find that Javascript in a Switch environment can do a lot more than Javascript in a browser environment.
Use the internet only for matters of syntax and methods of basic declaration types (although the documentation in the Switch help on basic Javascript is also pretty extensive and I prefer to use that).
You should write a script that emulates the behavior of "XML pickup": an incoming file triggers the scripts; it calls the API, which creates the XML, and it attaches the XML as a dataset.
As Dwight implicitly wrote: how you call the API from the script will depend on how the API works.
Freddy
Use the internet only for matters of syntax and methods of basic declaration types (although the documentation in the Switch help on basic Javascript is also pretty extensive and I prefer to use that).
You should write a script that emulates the behavior of "XML pickup": an incoming file triggers the scripts; it calls the API, which creates the XML, and it attaches the XML as a dataset.
As Dwight implicitly wrote: how you call the API from the script will depend on how the API works.
Freddy
Query an API for XML Job Ticket
A little late to the party here, but all the APIs we work with we tend to use either curl or wget in a javascript script (via Process.execute), then store the results (depending on the desired action).