Can not assign user to issue via Python API due to GDPR error

Hi

I use (the latest) atlassian-python-api to retrieve a task created with the software:

key = “AL-163”
taak = jira_instance.issue(key)

When I observe the fields in “taak” then I see the assignee tree with an accountid ‘5faxxxxxxxxxxxxxxxx453’.

Then I create an new task without an assignee (that works) and would like to assign that accountid later with:

assign_issue = jira_instance.assign_issue(“AL-177”, account_id = ‘5faxxxxxxxxxxxxxxxx453’)

but this does not work. I always get the error:
‘accountId’ must be the only user identifying query parameter in GDPR strict mode.

Clearing the assignee with
assign_issue = jira_instance.assign_issue(“AL-163”)
works as expected.

I think the account_id is correct since it is reported in the request of an issue and if I browse to
https://mario.atlassian.net/jira/people/5faxxxxxxxxxxxxxxxx453
I get the correct profile.

I have the latest python library:
mario@LAPTOP-MARIO:~$ pip show atlassian-python-api
Name: atlassian-python-api
Version: 3.20.1
Summary: Python Atlassian REST API Wrapper
Home-page: GitHub - atlassian-api/atlassian-python-api: Atlassian Python REST API wrapper

Can somebody help me?
It is very frustrating … :worried:

TIA
Mario

Welcome to the Atlassian Developer Community, @mariowitdoek !

I checked the Atlassian Python API wrapper’s implementation and in jira.py they are using a deprecated field name when assigning issues (see Assign issue docs for reference).

To fix this in the library, maybe you can raise a PR and contribute to the project by replacing name with accountId.

As a workaround, I checked the library and you can try using update_issue_field.

Here you can pass the assignee as a field. For reference, this is a sample body parameter when setting the assignee field while using Edit issue REST API. For this library, I assume you only need the assignee part.

{
    "fields":
    {
        "assignee":
        {
            "accountId": "<accountId>"
        }
    }
}

Hope this helps and do let us know how it goes.

Cheers,
Ian

1 Like

Another option would be to generate a Python client library from our latest spec. I described that process here: Generating a Python REST Client for Jira Cloud

I still had this problem today, even with the current version of the API updated. Today it checks for “self.cloud” bool, but this this is false by default. To fix this, just initialize your Jira object with “cloud = True”

1 Like

Welcome to the Atlassian Developer Community, @PabloNunesAgraBelmon!

Checking their documentation, you are correct, you have to explicitly set cloud to True when initializing the Jira object.

# Obtain an API token from: https://id.atlassian.com/manage-profile/security/api-tokens
# You cannot log-in with your regular password to these services.

jira = Jira(
    url='https://your-domain.atlassian.net',
    username=jira_username,
    password=jira_api_token,
    cloud=True)

Cheers,
Ian

1 Like