Skip to content
atlassian-dc-mcp
Esc
↑↓navigate↵open⌘Jpreview

Create an issue or sub-task from json

Creates an issue or a sub-task from a JSON representation. The fields that can be set on create, in either the fields parameter or the update parameter can be determined using the /rest/api/2/issue/createmeta resource. If a field is not configured to appear on the create screen, then it will not be in the createmeta, and a field validation error will occur if it is submitted. Creating a sub-task is similar to creating a regular issue, with two important differences:

  • the issueType field must correspond to a sub-task issue type (you can use /issue/createmeta to discover sub-task issue types), and
  • you must provide a parent field in the issue create request containing the id or key of the parent issue. The updateHistory param adds the project that this issue is created in, to the current user’s project history, if set to true (by default, the project history is not updated). You can view the project history in the Jira application, via the Projects dropdown.
POST/api/2/issue
Authorization
AuthorizationBasic auth · headerrequired

In order to use basic authorization, provide username:password Base64 encoded in the 'Authorization' header.

or
AuthorizationBearer token · headerrequired

Personal Access Token — Administration > Profile > Personal Access Tokens

AuthorizationBasic auth · headerrequired

In order to use basic authorization, provide username:password Base64 encoded in the 'Authorization' header.

Query parameters
updateHistoryboolean
default: false
Request body
application/json

Issue update bean

fieldsobject
historyMetadataHistoryMetadata
Show properties
activityDescriptionstring
activityDescriptionKeystring
actorHistoryMetadataParticipant
Show properties
avatarUrlstring
displayNamestring
displayNameKeystring
idstring
typestring
urlstring
causeHistoryMetadataParticipant
Show properties
avatarUrlstring
displayNamestring
displayNameKeystring
idstring
typestring
urlstring
descriptionstring
descriptionKeystring
emailDescriptionstring
emailDescriptionKeystring
extraDataobject
generatorHistoryMetadataParticipant
Show properties
avatarUrlstring
displayNamestring
displayNameKeystring
idstring
typestring
urlstring
typestring
propertiesEntityPropertyBean[]
Show properties
Array of EntityPropertyBean
keystring
valuestring
transitionTransitionBean
Show properties
descriptionstring
fieldsobject
idstring
namestring
opsbarSequenceinteger<int32>
toStatusJsonBean
Show properties
descriptionstring
iconUrlstring
idstring
namestring
selfstring
statusCategoryStatusCategoryJsonBean
Show properties
colorNamestring
idinteger<int64>
keystring
namestring
selfstring
statusColorstring
updateobject
Responses
201

Returns a link to the created issue.

idstring
keystring
selfstring
400

Returned if the input is invalid (e.g. missing required fields, invalid field values, and so forth).

Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'http://jira.example.com/rest/api/2/issue' \
  -H 'Authorization: Basic YOUR_CREDENTIALS' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "fields": "{\n\"assignee\": {\n    \"name\": \"bob\"\n},\n\"resolution\": {\n    \"name\": \"Fixed\"\n}",
  "historyMetadata": {
    "activityDescription": "text description",
    "activityDescriptionKey": "plugin.activity.i18.key",
    "actor": {
      "avatarUrl": "http://mysystem.com/avatar/tony.jpg",
      "displayName": "Tony",
      "displayNameKey": "tony",
      "id": "tony",
      "type": "mysystem-user",
      "url": "http://mysystem.com/user/tony"
    },
    "cause": {
      "avatarUrl": "http://mysystem.com/avatar/tony.jpg",
      "displayName": "Tony",
      "displayNameKey": "tony",
      "id": "tony",
      "type": "mysystem-user",
      "url": "http://mysystem.com/user/tony"
    },
    "description": "The issue was created.",
    "descriptionKey": "plugin.changereason.i18.key",
    "emailDescription": "email description",
    "emailDescriptionKey": "plugin.email.i18.key",
    "extraData": {
      "keyvalue": "extra data",
      "goes": "here"
    },
    "generator": {
      "avatarUrl": "http://mysystem.com/avatar/tony.jpg",
      "displayName": "Tony",
      "displayNameKey": "tony",
      "id": "tony",
      "type": "mysystem-user",
      "url": "http://mysystem.com/user/tony"
    },
    "type": "myplugin:type"
  },
  "properties": [
    {
      "key": "issue.support",
      "value": "{\"hipchat.room.id\":\"support-123\",\"support.time\":\"1m\"}"
    }
  ],
  "transition": {
    "description": "Close the issue.",
    "fields": {
      "property1": {
        "allowedValues": [
          "red",
          "blue",
          "default value"
        ],
        "autoCompleteUrl": "/rest/api/2/customFieldOption/10000",
        "defaultValue": {},
        "fieldId": "customfield_10000",
        "hasDefaultValue": true,
        "name": "My Multi Select",
        "operations": [
          "set",
          "add"
        ],
        "required": true,
        "schema": {}
      },
      "property2": {
        "allowedValues": [
          "red",
          "blue",
          "default value"
        ],
        "autoCompleteUrl": "/rest/api/2/customFieldOption/10000",
        "defaultValue": {},
        "fieldId": "customfield_10000",
        "hasDefaultValue": true,
        "name": "My Multi Select",
        "operations": [
          "set",
          "add"
        ],
        "required": true,
        "schema": {}
      }
    },
    "id": "2",
    "name": "Close Issue",
    "opsbarSequence": 10,
    "to": {
      "description": "The issue is currently being worked on.",
      "iconUrl": "http://localhost:8090/jira/images/icons/progress.gif",
      "id": "10000",
      "name": "In Progress",
      "self": "http://localhost:8090/jira/rest/api/2.0/status/10000",
      "statusCategory": {
        "colorName": "blue-gray",
        "id": 1,
        "key": "new",
        "name": "To Do",
        "self": "http://localhost:8090/jira/rest/api/2.0/statuscategory/1"
      },
      "statusColor": "green"
    }
  },
  "update": "\"comment\": [\n    {\n        \"add\": {\n            \"body\": \"Bug has been fixed.\"\n        }\n    }\n]"
}'
Response
{
  "id": "string",
  "key": "string",
  "self": "string"
}

Was this page helpful?