photools.com Community

IMatch Discussion Boards => IMatch Scripting and Apps => Topic started by: ben on May 29, 2017, 11:21:55 PM

Title: CURL and standalone script
Post by: ben on May 29, 2017, 11:21:55 PM
Hi Mario,

regarding the new scripting environment i have a few questions.

1) Can i change the browser to open an app from the app manager via the "open in external browser" button?
2) Can i use "curl" to retrieve data from iMatch? How would i do that? -> Would be easy to test commands
3) Can i write a plain script that actually doesn't run in the app panel, i.e. has no GUI?


Thanks for your help,
Ben
Title: Re: CURL and standalone script
Post by: Mario on May 30, 2017, 08:49:12 AM
1. IMatch instructs Windows to start the default web browser. You can change the default browser in Windows.

2. Yes. Be careful when you do POST, make sure you get the cUrl syntax right on the command line. Many tutorials out there.

2.a You can also just type the URL into the address bar of your browser. Much better and easier to work with that with the command line curl. Browsers also display the JSON pretty-printed, much easier to view for humans.

cUrl: Make a GET request for the  /info endpoint.

curl --request GET --compressed http://127.0.0.1:50519/info

Note: Port depends on your settings in IMatch under Edit > Preferences > Application.
IMatch returns GZIPped data so you have to let cUrl know that you want the decoded data, not the GZIPped data: --compress

3. The app panel is a web browser. It requires a HTML file to 'run' JavaScript.

See also: https://www.photools.com/developer-center/ for examples for Windows PowerShell.