curl command not found: -H error/problem solution, Malformed input to a URL function



  1. Problem

When you want to access a YouTrack issue, you can use to use curl. When i use curl, i get an error. I used under command.

$ curl -X GET \
https://youtrack.yourserver.com/api/issues/ISSUE-1 \ 
-H 'Accept: application/json' \
-H 'Authorization: Bearer your_token_value' \
-H 'Content-Type: application/json' 

And i saw this error.

{"error":"Unauthorized","error_description":"You are not logged in."}curl: (3) URL rejected: Malformed input to a URL function
zsh: command not found: -H
  1. Solution

This problem’s solution is very simple.

Make curl command one line. I remove ‘' and made command one line. This is a good solution. And then, problem is solved.

$ curl -X GET https://youtrack.yourserver.com/api/issues/ISSUE-1 -H 'Accept: application/json' -H 'Authorization: Bearer your_token_value' -H 'Content-Type: application/json' 

I hope it helps to solve your problem.