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. samuelwayne0

        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 [Atlassian]

        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. samuelwayne0

        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...