0

I am working on a shell script that would place get requests until the status is 202.

I have an issue with building the cURL command as mentioned below. Request is not being placed, even though the URL output by echo is correct. What am I doing wrong here?

get_path=$BASE_URL$location_header
echo "$get_path"
get_result="$(curl -i -s -X GET $get_path -H "Content-Type: application/json" -H "Authorization: Bearer $4")"
10
  • Is GET $getpath supposed to be one single argument to the -X option? In any case, $getpath should be double-quoted.
    – Kusalananda
    Dec 3, 2019 at 17:13
  • I tried double-quoted, - didn't work
    – Ihor M.
    Dec 3, 2019 at 17:16
  • Could you show us the contents of $get_path, or at least let us know what type of error you get? Also, when you double quoted, what did you double quote? The $get_path string or the GET $get_path string? Why do you even have -X GET? Isn't that the default?
    – Kusalananda
    Dec 3, 2019 at 17:18
  • get_path=http://localhost:8010/api/v0/part-of-url/syncJobs/5lhf51rrd1jxw
    – Ihor M.
    Dec 3, 2019 at 17:32
  • I see the following: * Closing connection -1
    – Ihor M.
    Dec 3, 2019 at 17:34

1 Answer 1

0

The problem was in the \r invisible character, that I was adding to my URL /syncJobs/{jobId}. I was extracting jobId from the Location header of the POST operation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.