Change Property of Issue Type Through API

rest-api
jira-cloud

#1

Hello All,

I would like to have an issue field drop-down choices updated on demand by a script. We would need to know if this is possible through the JIRA python module, or any way through the API, and if yes, how.
I found this in the API documentation, but I’m not sure this is what I need:

curl --request PUT \
  --url 'https://your-domain.atlassian.net/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "globalId": "SomeGlobalId",
  "myCustomLinkProperty": true,
  "colors": [
    "red",
    "green",
    "blue"
  ],
  "notes": [
    "Remote version links may take any well-formed JSON shape that is desired,",
    "provided that they fit within the maximum buffer size allowed,",
    "which is currently 32,768 characters."
  ]
}'

I unable to get property keys, I get empty answer for the request
https:/your-domain.atlassian.net/rest/api/3/issuetype/1/properties

{"keys":[]}

Thank you for the help in advance!


#2

Hi @tamas.juhasz,

would you need to update these options on the fly? (For example based on a choice the user makes on the screen?)

Or would this be more of a once-in-a-while kind of update?

This might be of interest to you: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest&utm_medium=302#api-api-3-field-fieldKey-option-optionId-put


#3

Hi pvandevoorde,

It is more like from time to time. Actually it is for VLAN selection in the ticket, and every time when our network team implements a new VLAN on network level, we would like to add that new VLAN to the options.


#4

Take a look at that REST API endpoint and the ones around it, those should help you out I think.


#5

I tried that already, bit didn’t really find the one that is for this purpose. That’s why I created this thread. I did not start without any investigation. :slight_smile: I also added what I found something like what I need, however I wasn’t able to make it work.


#6

The API call you posted is for update properties for a specific Issue type which is not how custom fields get populated.

So your VLAN select field is probably a single-select list, correct?
If yes, did you create this custom field as part of an app you’ve build? Or did you just create it through the admin UI?


#7

Honestly I’m not the JIRA admin, I just want to do the changes to it, thus, I’m not sure I know what exactly the differences are between issue type properties and custom fields. I suppose it was created through the admin UI.


#8

Not sure if I was clear enough what we need to achieve. Let me try to clarify:
We have an issue type called ‘New server’. In this issue type, when people creating new tickets to request new servers, on the new ticket form they can select the VLAN to put their servers into from a drop-down menu. The list of VLANs can change overtime, when new VLANs are added to the network system, and we would like to automate the update of this selection in case the list changes.


#9

Unfortunately, I believe there is currently no rest API to modify the options of built-in custom fields. There is only an API to modify the options of a custom field implemented by an add-on.


#10

@david2 just made the point I was aiming for. If those are just regular custom fields made by your admin then there is no API yet that can update those options. I should have clarified that those REST API endpoints are for custom fields made by an app only.


#11

That is clearly a bad news for us :). Can’t you suggest any other way to make our need work? By any add-on, or whatever?


#12

Also, shall I add a feature request somehow? :slight_smile:


#13

I did a quick search on https://jira.atlassian.com and found this feature request: https://jira.atlassian.com/browse/JRACLOUD-36112
I think that covers want you need, feel free to watch that ticket and add your vote to it.


#14

Looks nice! However, they have been implementing it since 2013 :slight_smile:
Thank you, I’m gonna keep an eye on it.