Hi, I have a question related to the Jira RESTAPI endpoint that allows me to get the metadata for creating issues of a given type in a give project. The endpoint is this (The API docs for the endpoint ):
/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}
Making a request to this endpoint yields a response like this:
{
"fields": [
{
"fieldId": "assignee",
"hasDefaultValue": false,
"key": "assignee",
"name": "Assignee",
"operations": [ "set" ],
"required": true
}
],
"maxResults": 1,
"startAt": 0,
"total": 1
}
As you can see we get 2 attributes fieldId and key, which always seem to have the same value.
Using the fieldId or key we can then make requests to create new work items or update an existing. For example to create a work item and set the assignee I would call POST /rest/api/3/issue with the following snippet in the payload
{
"fields": {
"assignee": {
"id": "5b109f2e9729b51b54dc274d"
}
}
}Question 1: which of these 2 attributes, fieldID or key should be used for making updates/creations of work items? I'm currently using key but I'm not sure this is the right way. Should we always use fieldId instead?
Hi @G_ ,
Welcome to the Atlassian Community!
The fieldID is the standard one that you would likely want to use when creating items or manipulating items via the REST API. Keys are typically leveraged for 3rd party apps that might create additional fields through their apps. In those cases the key would be the module key for the app. For standard Jira fields the fieldID and key will be the same.
You can review further within What's the difference between "id" and "key" for fields if you would like.
Best,
Andy
Thanks Andy
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.