I'm trying to add a weblink to a JIRA using the rest API.
Here is the curl I'm sending (modifying username, password and endpoint)
curl -k -v -D- -u my.name:MyPassWord -X POST -d '{"object": {"url":"http://www.mycompany.com/support?id=1","title":"Crazy customer support issue"}}' https://jira2-test.myserver.com/rest/api/2/issue/IMS-5181/remotelink
And here is the response I get
* About to connect() to jira2-test.myserver.com port 443 (#0)
* Trying XXXXXXXX..
* Connected to jira2.myserver.com (XXXXXX) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* subject: CN=*.myserver.com,O=TheOwner Inc.,L=Pleasanton,ST=California,C=US
* start date: Apr 30 00:00:00 2018 GMT
* expire date: Apr 29 12:00:00 2020 GMT
* common name: *.myserver.com
* issuer: CN=GeoTrust TLS RSA CA G1,OU=www.digicert.com,O=DigiCert Inc,C=US
* Server auth using Basic with user 'my.name'
> POST /rest/api/2/issue/IMS-5181/remotelink HTTP/1.1
> Authorization: Basic Z2VyLmRlbXBzZXk6REdEQmFieURCTTI=
> User-Agent: curl/7.29.0
> Host: jira2-test.myserver.com
> Accept: */*
> Content-Length: 98
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 98 out of 98 bytes
< HTTP/1.1 415
HTTP/1.1 415
< X-AREQUESTID: 119x1740069x5
X-AREQUESTID: 119x1740069x5
< X-ANODEID: jiradcrest
X-ANODEID: jiradcrest
< X-XSS-Protection: 1; mode=block
X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< Content-Security-Policy: frame-ancestors 'self'
Content-Security-Policy: frame-ancestors 'self'
< Set-Cookie: JSESSIONID=CE6CED48CFE8BFB78805783B5279E110; Path=/; Secure; HttpOnly
Set-Cookie: JSESSIONID=CE6CED48CFE8BFB78805783B5279E110; Path=/; Secure; HttpOnly
< X-Seraph-LoginReason: OK
X-Seraph-LoginReason: OK
< Set-Cookie: atlassian.xsrf.token=B3ND-AQI4-UGIM-SQA6_f668b404eda1a71ee75a19ba3af0a29c928bd815_lin; Path=/; Secure
Set-Cookie: atlassian.xsrf.token=B3ND-AQI4-UGIM-SQA6_f668b404eda1a71ee75a19ba3af0a29c928bd815_lin; Path=/; Secure
< X-ASESSIONID: c5mqlk
X-ASESSIONID: c5mqlk
< X-AUSERNAME: my.name
X-AUSERNAME: my.name
When I check the ticket, the link is not added, I don't see any obvious error in the response. Can someone please tell me what I'm doing wrong here?
You are sending the web request with the following encoding
Content-Type: application/x-www-form-urlencoded
And you response code is 415 (Unsupported Media Type). Perhaps try specifying "application/json" and try again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.