Changelog payload in webhook differs when changes are made in GUI vs API.

jean_francois_boismenu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 15, 2019

Hi,

While debugging our webhook, we've noticed that when a user edits the assignee of a ticket, the to and from fields of the webhook payload's changelog will contain an accountId on JIRA Cloud. However, when assigning a user using the API (/rest/api/latest/issue/<key>/assign) in our tests, we're getting the account name.

For example, this is what we get when editing the assignee in the GUI:

{
"changelog": {
"id": "11218",
"items": [
{
"field": "assignee",
"fieldId": "assignee",
"fieldtype": "jira",
"from": "<user-1-id>",
"fromString": "<user-1-name>",
"tmpFromAccountId": "<user-1-id>",
"tmpToAccountId": "<user-2-id>",
"to": "<user-2-id>",
"toString": "<user-2-name>"
}
]
}
}

And this is what we get when we edit the user via the API:

{
"changelog": {
"id": "11218",
"items": [
{
"field": "assignee",
"fieldId": "assignee",
"fieldtype": "jira",
"from": "<user-1-name>",
"fromString": "<user-1-name>",
"tmpFromAccountId": "<user-1-id>",
"tmpToAccountId": "<user-2-id>",
"to": "<user-2-name>",
"toString": "<user-2-name>"
}
]
}
}

We've looked at the entire payload of the webhook and it does not seem like there's any simple way to differentiate between the two values, aside from using a regular expression matching for an account id (and hoping nobody creates an account that matches it! 😜)

Which leads me to ask the following questions:

- What are tmp*AccountId? They look like they are the accountId for both users, but the use of tmp in front of these values makes me wary of using them. Are they going away? Will they be renamed? If so, to what? I haven't been able to find any documentation about these values.

- Is there a way to force the webhook to always receive accountId's?

- Is there a more obvious way than using a regex to know if the to/from values should be interpreted as the user name or accountId?

- We initially wrote our test using a local server, which can still accept the user's name when assigning an issue. However, according to the JIRA cloud documentation, name should not be a valid parameter anymore, and yet here we are and the assignment works on JIRA Cloud. How is that possible?

JF

PS: We tried updating the assignee using the accountId in our tests as a workaround and that generated also an event with user name instead of accountId, so we're out of luck.

 

0 answers

Suggest an answer

Log in or Sign up to answer