how to create an issue in jira via rest api?

后端 未结 9 2339
北恋
北恋 2020-12-08 19:24

Is it possible to create an issue in jira using REST api? I didn\'t find this in the documentation (no POST for issues), but I suspect it\'s possible.

A wget or curl

9条回答
  •  执笔经年
    2020-12-08 19:48

    In order to create an issue, set a time estimate and assign it to yourself, use this:

    1. Generate an Atlassian token

    2. Generate & save a base64-encoded auth token:

      export b64token="$(echo ":" | openssl base64)"

    3. Make a POST request:

    curl -X POST \
      https://.atlassian.net/rest/api/2/issue/ \
         -H 'Accept: */*' \
         -H 'Authorization: Basic $b64token \
         -d '{
           "fields":{
             "project":{
               "key":""
             },
             "issuetype":{
               "name":"Task"
             },
             "timetracking":{
               "remainingEstimate":"24h"
            },
             "assignee":{
               "name":""
           },
           "summary":"Endpoint Development"
         }
       }'
    

    Remarks:

    (*) Usually a short, capitalized version of the project description such as: ...atlassian.net/projects/UP/.

    (**) if you don't know your JIRA name, cURL GET with the same Authorization as above to https://.atlassian.net/rest/api/2/search?jql=project= and look for issues.fields.assignee.name.

提交回复
热议问题