Let me first point at that I'm new to KM and also to JSON request.
Here's my scenario:
I want to select a word and then copy it to the clipboard and use "Set Variable "xyz" to Text "SystemClipboard%" in order to use the openthesaurus.de API (www.openthesaurus.de/about/api) to get synonyms for the selected word.
I've then passed this to "Get URL "..." with "display results in a window, but all I get is nothing.
I see two possible issues here. (I'm no expert on this topic.)
First, you aren't passing the variable into the Get URL action. Your variable name is varSyn and you don't pass the variable anywhere into the URL.
Second, the Get URL action appears to be intended for use to get text or an image. I'm not really sure if it can work for you in this way. (I'm not a KM expert, just an average user.) I think you may need to convert this action to a different one called Execute Shell Script, and then pass it to the curl command. Like this:
I don't understand why you're trying to output a JSON string to a JPG file; that's not going to work...
NOTE:
It's never a good idea to compose a complex command from various parts at run-time.
It's better to compose the command string separately as I've done in the myQuery variable of my script, because this is harmless and can be easily visualized for initial testing and debugging.
Once you've composed your command string and checked to make sure it's correct, then you can run it.
It's way too easy to make cataclysmic errors in the shell, so one should make every effort to avoid them.
and did not get that error. I got this: (even when I typed it in using your script variable syntax)
{"metaData":{"apiVersion":"0.2","warning":"ACHTUNG: Bitte vor ernsthafter Nutzung feedback@openthesaurus.de kontaktieren, um bei API-\u00c4nderungen informiert zu werden","copyright":"Copyright (C) 2019 Daniel Naber (www.danielnaber.de)","license":"Creative Commons Attribution-ShareAlike 4.0 or GNU LESSER GENERAL PUBLIC LICENSE Version 2.1","source":"https://www.openthesaurus.de","date":"Sun Jun 30 10:12:30 CEST 2019"},"synsets":[]}
Is that the correct result? Perhaps you should try again, maybe the website was down. Or perhaps what you've got in your actions isn't what we can see. For example you may have some trailing spaces or CRs or tabs or something like that which is messing you up. In that case the only thing I can suggest is deleting the text in each of the two last actions in your macro and type them again carefully. Do not copy and paste to re-create them.
If the data above from the website is the correct answer, then it appears likely that the problem is your text includes odd characters that we cannot see. Because the text works for me.
Chris is always smarter than me, but I have an idea here. When you use it in a terminal window, you say it works, but how long does it take to get results? The problem is that the curl command may be timing out, returning an empty string. You can force curl to wait by using the parameter "connect-timeout" and specify the minimum number of seconds you want it to wait.
{"metaData":{"apiVersion":"0.2","warning":"ACHTUNG: Bitte vor ernsthafter Nutzung feedback@openthesaurus.de kontaktieren, um bei API-\u00c4nderungen informiert zu werden","copyright":"Copyright (C) 2019 Daniel Naber (www.danielnaber.de)","license":"Creative Commons Attribution-ShareAlike 4.0 or GNU LESSER GENERAL PUBLIC LICENSE Version 2.1","source":"https://www.openthesaurus.de","date":"Tue Jul 02 20:31:41 CEST 2019"},"synsets":[{"id":7083,"categories":[],"terms":[{"term":"Anleitung"},{"term":"Ausbildung"},{"term":"Belehrung"},{"term":"Lektion"},{"term":"Unterricht"},{"term":"Unterrichtung"}]}]}
So to me it seems to work.... In the terminal, but not in the macro...
If you are still getting no results from the Execute Shell Script action after inserting -v, then I think you need to flip on the error switch for the action by clicking on the cogwheel in the action and checking the box for "Include Errors". That may provide more information.