The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't update PR with API - used to work

Christian Bongiorno
Contributor
June 24, 2020

Until recently, I had been able to automatically update PRs based upon information from an incoming webhook. It now no longers work. Malformed reviewer list? I mean, that's all well and good, but what about it is malformed? Code:

 

$ curl -X PUT -H "accept: application/json" -H "content-type: application/json" -snL https://api.bitbucket.org/2.0/repositories/twengg/chb0-deleteme/pullrequests/1 -d '{
"title": "Add a sample jenkinsfile",
"reviewers": [
{
"uuid": "{1492c667-c0c5-4a6c-bf48-496d9985df2d}"
},
{
"uuid": "{bc0329d8-c162-4e2f-b827-cddff42d1909}"
},
{
"uuid": "{0113c401-0b3c-4994-b905-07ddce749b15}"
}
]}'



gets me:

{
"type": "error",
"error": {
"fields": {
"reviewers": [
"Malformed reviewers list"
]
},
"message": "reviewers: Malformed reviewers list"
}
}
 

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Ben G
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 29, 2020

Hi @Christian Bongiorno sorry that API response error message isn't very helpful, I'll create a ticket to get that fixed up to show a more descriptive error message.

Looking at the list of users above, it appears that the third one is an account that's marked as "inactive" which is where the validation error is coming from.

Here's what the 2.0 Users API shows for that user:

GET https://api.bitbucket.org/2.0/users/%7B0113c401-0b3c-4994-b905-07ddce749b15%7D/?fields=display_name,account_status

{"account_status": "inactive", "display_name": "<redacted>"}

To unblock your integration for now, you could filter out any inactive accounts using the same 2.0 Users API. Not ideal for sure but hopefully that will keep things working for you.

As a longer term solution maybe - would you mind sharing which type of webhook you're receiving that users list from also? I can look into potentially filtering out inactive users from those webhook payloads - not guaranteed that will be possible yet, I'll need to see if it makes sense in the context of the webhook.

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events