"Unable to parse request. [null] is missing" 400 error when using Update Workflow REST API

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Cloud のみ - この記事は クラウド プラットフォームのアトラシアン製品に適用されます。

   

要約

The user is trying to Bulk Update the workflow's property via the REST API but gets a 400 error: 

{
    "errorMessages": [
        "Unable to parse request. [null] is missing."
    ],
    "errors": {}
} 

診断

The error is observed when the required parameters for the endpoint /rest/api/3/workflows/update have not been added to the payload or the current version of the workflow is not reflected. This usually happens when trying to update a single functionality in the workflow (like a property), thus providing a payload without all the required parameters.

POST https://XXXXX.atlassian.net/rest/api/3/workflows/update

Entire body is displayed below:

{
     "statuses":[
         {
            "name":"To Do",
            "statusCategory":"TODO",
            "statusReference":"3953ee0d-dc3a-402b-8977-5eecc7e620b5"
         }
      ],
      "workflows":[
         {
            "id":"3953ee0d-dc3a-402b-8977-5eecc7e620b5",
            "statuses":[
               {
                  "id":"10009",
                  "properties":{
                     "jira.issue.editable":"true"
                  }
               }
            ]
         }
      ]
}  


response 400:

{
    "errorMessages": [
        "Unable to parse request. [null] is missing."
    ],
    "errors": {}
} 


ソリューション

  1. Fetch the workflow you want to change using bulk get workflows. This will return the current state and the current version of the workflow which are mandatory among other fields for the update call.
    • TIP: use the expand property to fetch the status names  - /rest/api/3/workflows?expand=statuses.usages. Without this property status details don't include their names but ids as with names statuses are quickly identified.
    • do note that you need to specify either of "projectAndIssueTypes": [], "workflowIds": [], "workflowNames": [] parameters for this request. As an example, the workflowNames can be used which is returned via the Get workflows paginated. 

      {
       "projectAndIssueTypes": [],
       "workflowIds": [],
        "workflowNames": [
          "NAME_OF_THE_WORKFLOW"
        ]
      } 
  2. Here is the result:


  3. Copy the response body and add it as a payload to the next request in p.5.
  4. Then we can manipulate the workflow with the desired change in the payload for the bulk update.
    • In this example we are updating a property of a status. The previous call returned the statusReferences and in their properties parameter, we can add a change.
    • From true:

      ......
      		"statuses": [
                      {
                          "statusReference": "10009",
                          "layout": {
                              "x": 428.75,
                              "y": 67.4
                          },
                          "properties": {
                              "jira.permission.modifyreporter.user": "true"
                          },
                          "deprecated": false
                      },
      .....
    • To false:

      ......
      		"statuses": [
                      {
                          "statusReference": "10009",
                          "layout": {
                              "x": 428.75,
                              "y": 67.4
                          },
                          "properties": {
                              "jira.permission.modifyreporter.user": "false"
                          },
                          "deprecated": false
                      },
      .....
  5. Finally, run the update using the original endpoint workflow update post by using the response from step 1 as payload here.




Last modified on Mar 22, 2024

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.