Uploaded image for project: 'Jira Align'
  1. Jira Align
  2. JIRAALIGN-4193

REST API 2.0: Adding a link via PATCH or PUT is not working as expected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 10.109.0
    • 10.107.4
    • REST API
    • 1
    • Severity 3 - Minor
    • No

      Issue Summary

      Doing a PATCH or a PUT request to rest/align/api/2/Epics/EpicId endpoint to add a link to a work item will return the error :

      "Cannot update epic with id EpicId. Cannot update links. Id shouldn't be empty."

      Steps to Reproduce

      Make a PATCH request to rest/align/api/2/Epics/EpicId endpoint with the following body:

      [
        {
          "op": "add",
          "path": "/links/0",
          "value": {
             "name": "linkymclinkface",
             "link": "somelink.com"
          }
        }
      ] 

      OR

      Make a PUT request to rest/align/api/2/Epics/EpicId endpoint with the following body:

      {
          "title": "TestLink4Epic",
          "ownerId": "<ownerId>",
          "description": "TestLink4Epic",
          "primaryProgramId": <programId>,
          "state": 1,
          "type": 1,
          "links": [
              {
                  "name": "linkymclinkface",
                  "link": "somelink.com"
              }
          ]
      }
      

      Expected Results

      PATCH method operations should work with additional links 

      The add operation should return an error if a linkId is provided

      Actual Results

      The error "Cannot update epic with id EpicId. Cannot update links. Id shouldn't be empty." is returned.

      Workaround

      Specify an id (made up) in the request of the body.
      For example for the PATCH request:

      [
        {
          "op": "add",
          "path": "/links/0",
          "value": {
             "id": 100,
             "name": "linkymclinkface",
             "link": "somelink.com"
          }
        }
      ]
      

      It will result in a 204 code and the link created.
      Note: If you GET the work item content, you will see that the response body may contain a different id (than the one specified unless it corresponds to the next one in the database).

              kforeman@atlassian.com Kyle Foreman
              646db21d89d1 Francois Panaget
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: