I’m trying to write some generic code that can send edits for any field to Jira Cloud through the API. Simple fields like string and number seem pretty straightforward, but I’m having a hard time figuring out a generic way to send updates for complex fields (such as issuetype, project, user, or arbitrary custom fields).
So far, it looks like the best way would be to use the editmeta (from GET /rest/api/2/issue/{issueIdOrKey}/editmeta) to dynamically determine the format, but that seems to be missing important information for several fields. Here are some examples of missing or unclear information from what I’ve seen with a Jira Cloud test instance and several Postman requests:
I’ve seen a few other anomalies like this not listed here as well. I suppose my main questions then are
Hi @dataservice
I write to lots of the fields (generic fields and customfields) in our projects, via the API, but I generally perform a GET and look at the format then mimic it. So to generalise it as you're wanting, I'm not sure.
To answer a couple of your queries :
5. This usually appears when the field isn't on the Edit screen of that project - check and add the field
4. Below is some typical JSON to create an issue and link it to another. The name, inward and outward values are specific to your Jira instance
{
"fields": {
"project": {
"key": "DS"
},
"issuetype": {
"name": "Task"
},
"summary": "Linking issues",
"description": "Issue linking"
},
"update": {
"issuelinks": [
{
"add": {
"type": {
"name": "Relates",
"inward": "relates to",
"outward": "relates to"
},
"outwardIssue": {
"key": "DS-29"
}
}
}
]
}
}
I've been waiting to see if any other answers came before accepting this as the answer. Thank you for your help on those couple of questions!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.