How can i set issue restriction when using Jira API to create an issue?

Rene van Veen September 25, 2023

When using the Jira API (v2) i also like to set the Restrictions.

I did try to set it using:

fields: {issuerestriction: { 'issuerestrictions': { 'projectrole': [ {'restrictionValue': 'xx'} ] } }

This returns me an error when using the API:

{"issuerestriction":"Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token\n at [Source: N/A; line: -1, column: -1]"}}

Is there an other way to set the Security level / Restriction when using the API for a Next-Gen project?

 

1 answer

1 accepted

0 votes
Answer accepted
ELFAPP Technologies September 25, 2023

Hi

It seems that you're not using the right payload for your update. As you're calling the key "issuerestriction" twice and all keys should be wrapped in quotes (depending on which language you use). Your payload should look like the below sent with a "PUT" HTTP method

payload = {
"fields": {"issuerestriction": {"projectrole": [{"restrictionValue": "10xxx"}]}}
}

Where value "10xxx" is the project role id. With that, you can set the restrictions on your Team Managed projects.

Rene van Veen September 28, 2023

Tnx that working!!.. I was looking to the structure when i did a get on a ticket.. and then it shows it like that.


Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events