It appears that my script is missing my -H option when I am trying to get a response. It is complaining that it is a syntax issue, but it doesn't appear to be. Anyone seen this issue before? I have taken out any identifying info about the API. I have tested this in a terminal, and it returns data correctly
Code:
import org.apache.log4j.Level
import org.apache.log4j.Logger
def log = Logger.getLogger("com.acme.workflows")
log.setLevel(Level.DEBUG)
def headers = "Bearer 12345678-1234-1234-1234-123456789120"
//def response = "curl -H \"Authorization: Bearer 12345678-1234-1234-1234-123456789120\" https://url.com/api/path/end"
def response = 'curl -H \'Authorization: Bearer 12345678-1234-1234-1234-123456789120\' https://url.com/api/path/end'
def proc = response.execute();
proc.waitFor();
log.debug(proc.exitValue())
log.debug(proc.err.text)
log.debug(proc.in.text)
I have also tried without the escapes (\') and with double quotes. It seems like each combination is still throwing errors
Errors:
curl: (6) Could not resolve host: Bearer; Name or service not known
curl: (6) Could not '; Name or service not known
Response:
{"timestamp":1578586566943,"status":401,"error":"Unauthorized","message":"Full authentication is required to access this resource","path":"/api_data/all_data"}