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

API 2.0: PATCH call towards /align/api/2/Users/<id> results in HTTP 400 Error Bad Request

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 10.92
    • 10.87, 10.88
    • REST API
    • None
    • 1
    • Severity 2 - Major
    • Breakers - VH5
    • No

      Issue Summary

      PATCH call towards /align/api/2/Users/<id> results in HTTP 400 Error: Bad Request error message when the following fields are empty instead of null:

      "company": "",
      "companyId": "",

      User system role update in UI is successfull, and both fields are set to null immediately.

      Steps to Reproduce

      1. Find any user that has company and/or companyId values set to '' (empty) instead of null
      2. Make a PATCH call towards /align/api/2/Users/<id> with the following request body:
        (in this example, the API is trying to change user's system role):
        [
            {
                "op": "replace",
                "path": "/roleId",
                "value": &lt;integer&gt;
            }
        ]
      3. Notice the error

      Expected Results

      • Given company and/or companyId fields are NOT mandatory, the PATCH call should flawlessly update user's details regardless of company and/or companyId values.

      Actual Results

      • Notice the following error code is returned, along with the respective response body:
        HTTP 400 Error: Bad Request
        Cannot update user with id &lt;id&gt;. company must be between 1 and 100 characters. companyId must be between 1 and 50 characters.

      Workaround

      Reportedly working on Build 10.88.0.15267
      • Make the PATCH call by using the following request body in addition to the data you want to update:
        (update user's system role on this case)
        [
            {
                "op": "replace",
                "path": "/companyId",
                "value": null
            },
            {
                "op": "replace",
                "path": "/company",
                "value": null
            },
            {
                "op": "replace",
                "path": "/roleId",
                "value": &lt;integer&gt;
            }
        ]

              kforeman@atlassian.com Kyle Foreman
              rcortez@atlassian.com Rodrigo Cortez
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: