REST API to update security level in a Jira issue

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

In this article we will describe a scenario where security level field can be set using REST API.

This could be helpful in below mentioned scenarios:

  • User want to update security level field of an issue.

環境

Jira Core 8.x 以降

ソリューション

With editIssue REST API, we can set security level in a ticket. Following is an example. 


  •  Make sure to replace securitylevel (10000) with actual securitylevel ID
  • KAN1-1 should be replaced with the actual issuekey
curl -v -u "username:password" -X PUT -H 'Content-Type: application/json' -d '{"fields":{"security":{"self": "http://localhost:8080/rest/api/2/securitylevel/10000","id": "10000","description": "It is internal to administrator group","name": "Internal"}}}' http://IP:HOST/rest/api/2/issue/KAN1-1

*   Trying ::1:8080...
* Connected to localhost (::1) port 8080 (#0)
* Server auth using Basic with user 'cpandey'
> PUT /rest/api/2/issue/KAN1-1 HTTP/1.1
> Host: localhost:8080
> Authorization: Basic Y3BhbmRleTphdHJhdG9y
> User-Agent: curl/7.77.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 39
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 204
< X-AREQUESTID: 977x982x1
< Referrer-Policy: strict-origin-when-cross-origin
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< Content-Security-Policy: sandbox
< Strict-Transport-Security: max-age=31536000
< Set-Cookie: JSESSIONID=516792C688AA227CB9D474260673E25C; Path=/; HttpOnly
< X-Seraph-LoginReason: OK
< Set-Cookie: atlassian.xsrf.token=BE8V-QK7K-JHAJ-01LP_9d609442b9ac33aadf1d1aa177e5e3f5fc8b58d5_lin; Path=/
< X-ASESSIONID: z7qfjp
< X-AUSERNAME: cpandey
< Cache-Control: no-cache, no-store, no-transform
< Content-Type: application/json;charset=UTF-8
< Date: Tue, 29 Mar 2022 10:47:19 GMT
<
* Connection #0 to host localhost left intact





最終更新日: 2022 年 12 月 15 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.