Icon
Join thousands of Atlassian users for an unforgettable week of knowledge sharing, product training, networking, and fun. Atlassian Summit is Oct 10 - 13 in San Jose, CA – Register soon before tickets sell out.
Icon
Maintenance Notice: answers.atlassian.com will undergo maintenance on 24 Sep 2016, from 22:00 - 07:00 UTC. During this maintenance window, the service may be intermittently unavailable. See our status page for details.
 
1
0
-1

Hi,

When I tried to create an issuelink from REST API v4.4, I noticed that when you pass the credentials in your curl example, all works fine and the link is created. But when you use the cookie that's already set, it says "You don't have permission to view the specified issue". Certainly, I did verify that there is no session time-out.

    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      This was a bit tricky. I tried it out and have a guess as to what might be happening to you.

      Try this, when logging in:

      curl -c cookie.txt -H "Content-Type: application/json" -d '{"username" : "admin", "password" : "admin"}' http://localhost:8080/rest/auth/latest/session

      Note in particular the "-c cookie.txt" section. I suspect your login wasn't actually writing out a cookie, but only giving the JSON response.

      I've added a note to the documentation.

      1. Samuel Wayne

        Thanks Jeremy. I was logging in using the exact same command as you suggested. But still I get the same Permission issue. I'm not sure where it went wrong.

      2. Jeremy Largman

        I'm doing my testing on localhost (a downloaded version), and not over https, but I got it working. Here's my exact syntax, for both commands:

        curl -c cookie.txt -H "Content-Type: application/json" -d '{"username" : "admin", "password" : "admin"}' http://localhost:8080/rest/auth/latest/session
        curl -b cookie.txt -H "Content-Type: application/json" -d '{ "linkType": "Duplicate", "fromIssueKey": "TEST-1", "toIssueKey": "TEST-2" }' http://localhost:8080/rest/api/2.0.alpha1/issueLink

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Can you post the curl commands?

      1. Samuel Wayne

        curl -b cookie-jar -H "Content-Type: application/json" -d '{ "linkType": "Duplicate", "fromIssueKey": "TEST-1", "toIssueKey": "TEST-2" }' https://company-name.atlassian.net/api/2.0.alpha1/issueLink

      CommentAdd your comment...