POST /rest/api/2/issue (create issue) throws error when passing entity properties

The documentation for the POST /rest/api/2/issue endpoint (Create issue) specifies that you can pass issue entity properties in the “properties” attribute of the body. Whenever I try that, I get this error:
Incorrect request: ["N/A (through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"properties\"])"]

Here’s my payload:

{
  "fields": {
    "project": {
      "key": "TEST"
    },
    "issuetype": {
      "id": "10002"
    },
    "summary": "CLONE - ddd"
  },
  "properties": [
    {
      "jmwe-created-from": {
        "key": "TEST-1671"
      }
    },
    {
      "jmwe.create.chain": [
        {
          "transition": {
            "executionId": "2e5a386e-2cbf-4d8d-9b55-2022577e3a41",
            "to_status": "To Do",
            "transitionId": 1,
            "workflowName": "TEST: Task Management Workflow",
            "from_status": "",
            "transitionName": "Create",
            "context": {}
          },
          "configMD5": "068c3fa633959578d9f7a3dc3acb03cb"
        }
      ]
    }
  ]
}

Do you see anything I’m doing wrong?

Thanks,
David

1 Like

Why not use the property endpoint? I personally update the properties individually via PUT

@ernst.stefan Because by the time you get the answer back from the Create call with the new issue key, post functions located on the Create transition are already triggered. This is normally not a problem because we delay the execution of post-functions residing on the Create transition. However, if the Jira instance is overloaded and starts returning errors (such as 429) from the property set endpoint, we do retries which delays setting the entity property past the post-function execution delay.
We need to set the issue entity property in the same “transaction” as the issue creation.

@dmorrow could you please look into this?

1 Like

Hi @david2,

I think you’ve formatted the properties incorrectly. For example, let’s say an app defines an entity property module as follows:

"jiraEntityProperties": [
  {
    "key": "refapp-issue-complexity",
    "name": {
      "value": "Issue Complexity"
    },
    "entityType": "issue",
    "keyConfigurations": [
      {
        "propertyKey": "issueComplexity",
        "extractions": [
          {
            "objectName": "complexity",
            "type": "number",
            "alias": "issueComplexityValue"
          }
        ]
      }
    ]
  }
],

This app should be able to create issues with entity property values using the following payload:

{
  "fields": {etc}
  "properties": [
    {
      "key": "issueComplexity",
      "value": 5
    }
  ]
}

Regards,
Dugald

1 Like

Thanks @dmorrow you are right, it works this way. It’s just the documentation that is misleading (it doesn’t show any “value” in the example).

2 Likes