curl: (1) Protocol "'https" not supported or disabled in libcurl

alex seol February 11, 2019

Hi, Team.

I tested the creation of the jira project in cURL by referring to the URL below.

https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-project-post

 

I get the following error:

C:\ideaic\curl>curl --request POST --url 'https://domain:8080/rest/api/3/project' --header 'Authorization: Bearer ' --header 'Accept:  pplication/json' --header 'Content-Type: application/json' --data '{"key": "EX","name": "Example","projectTypeKey": "business","projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-simplified-project-management","description": "Example Project description","leadAccountId": "bd429c95-e27b-4423-a0bd-421cf3d69129","url": "http://domain:8080","assigneeType": "PROJECT_LEAD","avatarId": 10200,"issueSecurityScheme": 10001,"permissionScheme": 10011,"notificationScheme": 10021,"categoryId": 10120}'curl: (1) Protocol "'https" not supported or disabled in libcurlcurl: (6) Could not resolve host: Bearercurl: (6) Could not resolve host: 'curl: (6) Could not resolve host: pplicationcurl: (6) Could not resolve host: applicationcurl: (6) Could not resolve host: EX,namecurl: (6) Could not resolve host: Example,projectTypeKeycurl: (6) Could not resolve host: business,projectTemplateKeycurl: (6) Could not resolve host: com.atlassian.jira-core-project-templates:jira-core-simplified-project-management,descriptioncurl: (6) Could not resolve host: Example Project description,leadAccountIdcurl: (6) Could not resolve host: bd429c95-e27b-4423-a0bd-421cf3d69129,urlcurl: (6) Could not resolve host: domain:8080,assigneeTypecurl: (6) Could not resolve host: PROJECT_LEAD,avatarIdcurl: (6) Could not resolve host: 10200,issueSecuritySchemecurl: (6) Could not resolve host: 10001,permissionSchemecurl: (6) Could not resolve host: 10011,notificationSchemecurl: (6) Could not resolve host: 10021,categoryIdcurl: (3) [globbing] unmatched close brace/bracket in column 6
C:\ideaic\curl>

 

What did wrong?


Alex

 

 

 

3 answers

2 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2019

I think it's your use of ' for every single parameter - I don't think windows understands that correctly.  Could you try the command without using 's?

alex seol February 13, 2019

Hi, Nic

What does 's' mean?

Does it mean 's' in 'https'?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2019

No, I used 's to mean the plural of '

You should remove most of the ' in your command and use " instead, as your OS is getting it wrong.

alex seol February 14, 2019

Hi, Nic

I knew it was plural "s".

However, there is no use of plural ("s") in 'command and use' which I used.

(Below, Alexey's guided double quotes do not cause an error.)

(But the Jira project is not created)

curl --request POST --url "http://company.domain:8080/rest/api/2/project" --header "Authorization:Bearer" --header "Accept:pplication/json" --header "Content-Type:application/json" --data "{""key"":""EX"",""name"":""Example"",""projectTypeKey"":""business"",""projectTemplateKey"":""com.atlassian.jira-core-project-templates:jira-core-simplified-project-management"",""description"":""Example Project description"",""lead"":""dhseol"",""url"":""http://company.domain:8080"",""assigneeType"":""PROJECT_LEAD"",""avatarId"": 10200,""issueSecurityScheme"":10001,""permissionScheme"":10011,""notificationScheme"":10021,""categoryId"":10120}'

I would be grateful if you can tell which part is my OS misunderstanding.

Cheers,

Alex

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 18, 2019

No, again, it's the ' marks, not s.

Although your header line is also incorrect, missing letters

Like Holly Marsh likes this
alex seol February 18, 2019

Hi, Nic.

I can not understand your explanation.

For example, please explain.

Cheers,

Alex.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2019

Your original code uses 's which do not work.  The code you've given in the comment before last has spelling mistakes in the --header data.

alex seol February 20, 2019

Hi, Nic

thank you for your help.

But I found workaround.

So I quit.

Thank you for your help always.

Cheers,

Alex

0 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2019

I think something is wrong with passing parameters with curl.

Here is my example, which works

curl -i -u sysadmin:sysadmin -X PUT http://localhost:8081/rest/api/2/user/?username=user1 -H "Content-Type:application/json" --data '{"name": "user"}'

alex seol February 13, 2019

Hi. Alexey

Thank you for your guide.

I modified it according to your guide as follows.

curl -i -u jiraadmin:1Qejrghks -X PUT http://domain:8080/rest/api/2/user/?username=admin -H "Content-Type:application/json" --data '{"key": "EX","name": "Example","projectTypeKey": "business", "projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-simplified-project-management", "description": "Example Project description", "leadAccountId": "bd429c95-e27b-4423-a0bd-421cf3d69129","url": "http://domain:8080","assigneeType": "PROJECT_LEAD","avatarId": 10200,"issueSecurityScheme": 10001,"permissionScheme": 10011,"notificationScheme": 10021,"categoryId": 10120}'

 

However, the following error occurs.

C:\ideaic\curl>curl -i -u xxxxx:cxxxxxx -X PUT http://company.domain:8080/rest/api/2/user/?username=admin -H "Content-Type:application/json" --data '{"key": "EX","name": "Example","projectTypeKey": "business", "projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-simplified-project-management", "description": "Example Project description", "leadAccountId": "bd429c95-e27b-4423-a0bd-421cf3d69129","url": "http://company.domain:8080","assigneeType": "PROJECT_LEAD","avatarId": 10200,"issueSecurityScheme": 10001,"permissionScheme": 10011,"notificationScheme": 10021,"categoryId": 10120}'HTTP/1.1 400X-AREQUESTID: 911x290x1X-XSS-Protection: 1; mode=blockX-Content-Type-Options: nosniffX-Frame-Options: SAMEORIGINContent-Security-Policy: frame-ancestors 'self'X-ASEN: SEN-9916902Set-Cookie: JSESSIONID=60437F8E9EAED86C03E7C72D6F24F123; Path=/; HttpOnlyX-Seraph-LoginReason: OKSet-Cookie: atlassian.xsrf.token=BQEM-4XQF-SUI6-5P7C_a2fe448823bb22c5355ea44ce088f2c294ccf1cc_lin; Path=/X-ASESSIONID: 1mxb11sX-AUSERNAME: jiraadminCache-Control: no-cache, no-store, no-transformContent-Type: application/json;charset=UTF-8Transfer-Encoding: chunkedDate: Thu, 14 Feb 2019 06:11:14 GMTConnection: close
{"errorMessages":["Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@224738dc; line: 1, column: 2]"]}curl: (6) Could not resolve host: EX,namecurl: (6) Could not resolve host: Example,projectTypeKeycurl: (6) Could not resolve host: business,curl: (6) Could not resolve host: projectTemplateKeycurl: (3) Illegal port numbercurl: (6) Could not resolve host: descriptioncurl: (6) Could not resolve host: Example Project description,curl: (6) Could not resolve host: leadAccountIdcurl: (6) Could not resolve host: bd429c95-e27b-4423-a0bd-421cf3d69129,urlcurl: (6) Could not resolve host: domain:8080,assigneeTypecurl: (6) Could not resolve host: PROJECT_LEAD,avatarIdcurl: (6) Could not resolve host: 10200,issueSecuritySchemecurl: (6) Could not resolve host: 10001,permissionSchemecurl: (6) Could not resolve host: 10011,notificationSchemecurl: (6) Could not resolve host: 10021,categoryIdcurl: (3) [globbing] unmatched close brace/bracket in column 6
C:\ideaic\curl>

 

 

I am waiting for your help.
Cheers,

Alex

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2019

 

Look at this post, it has the same error like you. And you should use double quotes:

https://stackoverflow.com/questions/11834238/curl-post-command-line-on-windows-restful-service

alex seol February 14, 2019

Hi, Alexey.

I used the double quotation marks as shown below with reference to your guide.

curl --request POST --url "http://company.domain:8080/rest/api/2/project" --header "Authorization:Bearer" --header "Accept:pplication/json" --header "Content-Type:application/json" --data "{""key"":""EX"",""name"":""Example"",""projectTypeKey"":""business"",""projectTemplateKey"":""com.atlassian.jira-core-project-templates:jira-core-simplified-project-management"",""description"":""Example Project description"",""lead"":""dhseol"",""url"":""http://company.domain:8080"",""assigneeType"":""PROJECT_LEAD"",""avatarId"": 10200,""issueSecurityScheme"":10001,""permissionScheme"":10011,""notificationScheme"":10021,""categoryId"":10120}'

No error will occur. But there is no response. Project "Example" was not created.

 

What should I do now? No error occurred, but no project was created.

Cheers,

Alex

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2019
alex seol February 11, 2019

 

Hi. Alexey

Thank you for your help.

I changed to "rest / api / 2 / project" as you explained.

As you can see, we changed some values by referring to the URL below.

https://docs.atlassian.com/software/jira/docs/api/REST/7.12.0/?_ga=2.36853728.1513002746.1547637396-1149622764.1547637396

curl error 2.png

However, when you run Curl, the same error occurs.

 

C:\ideaic\curl>curl --request POST --url 'http://domain:8080/rest/api/2/project' --header 'Authorization: Bearer ' --header 'Accept:  pplication/json' --header 'Content-Type: application/json' --data '{"key": "EX","name": "Example","projectTypeKey": "business","projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-simplified-project-management","description": "Example Project description","lead": "dhseol","url": "http://domain:8080","assigneeType": "PROJECT_LEAD","avatarId": 10200,"issueSecurityScheme": 10001,"permissionScheme": 10011,"notificationScheme": 10021,"categoryId": 10120}'curl: (1) Protocol "'http" not supported or disabled in libcurlcurl: (6) Could not resolve host: Bearercurl: (6) Could not resolve host: 'curl: (6) Could not resolve host: pplicationcurl: (6) Could not resolve host: applicationcurl: (6) Could not resolve host: EX,namecurl: (6) Could not resolve host: Example,projectTypeKeycurl: (6) Could not resolve host: business,projectTemplateKeycurl: (6) Could not resolve host: com.atlassian.jira-core-project-templates:jira-core-simplified-project-management,descriptioncurl: (6) Could not resolve host: Example Project description,leadcurl: (6) Could not resolve host: dhseol,urlcurl: (6) Could not resolve host: domain:8080,assigneeTypecurl: (6) Could not resolve host: PROJECT_LEAD,avatarIdcurl: (6) Could not resolve host: 10200,issueSecuritySchemecurl: (6) Could not resolve host: 10001,permissionSchemecurl: (6) Could not resolve host: 10011,notificationSchemecurl: (6) Could not resolve host: 10021,categoryIdcurl: (3) [globbing] unmatched close brace/bracket in column 6
C:\ideaic\curl>

 

 

What is the problem?

Best Regards.

Alex.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2019

Try to replace "" with \"

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2019

Or here is another suggestion:

For me under Windows I needed to escape quotes using quotes in this format "{ """key1""": """value1""" }"

alex seol February 18, 2019

Hi, Alexey.

We changed the source as shown below. However, this time an error will occur.
C:\ideaic\curl>curl --request POST --url 'http://company.domain:8080/rest/api/3/project' --header 'Authorization: Bearer ' --header 'Accept: application/json' --header 'Content-Type: application/json' --data '{"""key""": """EX""","""name""": """Example""",""""projectTypeKey""": """business""",""""projectTemplateKey""": """com.atlassian.jira-core-project-templates:jira-core-simplified-project-management"""","""description""": """Example Project description""","""leadAccountId""": """bd429c95-e27b-4423-a0bd-421cf3d69129""","""url""": """http://company.domain:8080""","""assigneeType""": """PROJECT_LEAD""","""avatarId""": 10200,"""issueSecurityScheme""": 10001,"""permissionScheme""": 10011,"""notificationScheme""": 10021,"""categoryId""": 10120}'
curl: (1) Protocol "'http" not supported or disabled in libcurl
curl: (6) Could not resolve host: Bearer
curl: (6) Could not resolve host: '
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: "EX","name"
curl: (6) Could not resolve host: "Example","projectTypeKey": "business",""projectTemplateKey"
curl: (3) Illegal port number
curl: (6) Could not resolve host: Project
curl: (3) [globbing] unmatched close brace/bracket in column 259

C:\ideaic\curl>

 

Cheer,

Alex.

mesa sisa June 29, 2020

Hello there,

try this:

def proc = ["curl", "-D-","-u","user:password","-X","POST","--data","{}","<http://jira/rest...>","-H","Content-Type:application/json"].execute()
proc.waitFor()

log.debug("Process exit code: ${proc.exitValue()}")
log.debug("Std Err: ${proc.err.text}")
log.debug("Std Out: ${proc.in.text}")

 

if you do it like this, then groovy is not messing up spaces.

Regards,

Mehmet

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events