openterm
openterm copied to clipboard
curl inside captureShell
I tried to make a script with
info = captureShell("curl --request GET --url 'https://your-domain.atlassian.net/wiki/rest/api/settings/systemInfo' --user '[email protected]:<api_token>' --header 'Accept: application/json') println(info)
I use for this https://developer.atlassian.com/cloud/confluence/rest/#api-settings-systemInfo-get
I have a working account at confluence and on OpenTerm everything works perfect with the curl-command.
But in script-mode i get the correct REST-Result and
{json-result}curl: (6) Could not resolve host: --request curl: (6) Could not resolve host: GET curl: (6) Could not resolve host: --url curl: (6) Could not resolve host: --user curl: (3) Port number ended with 'c' curl: (6) Could not resolve host: --header curl: (3) Port number ended with ' '
This seems strange. Need i to escape something?
Ok i found a workaround-solution over a temporary file:
captureShell("curl --request ... | tee tmp.txt") info = captureShell("cat tmp.txt") println(info) captureShell("rm tmp.txt")