Manage API tokens for service accounts
You can use an API token to authenticate a script with an Atlassian cloud app. You generate the token for your service account, then copy and paste it into a script.
認証に 2 段階認証を使用する場合、スクリプトでは REST API トークンによって認証する必要があります。
What is an API token?
A primary use case for API tokens is to allow scripts to access REST APIs for Atlassian cloud apps using HTTP basic authentication.
使用する HTTP ライブラリの詳細によっては、パスワードをトークンで置き換えることができます。たとえば、curl を使用している場合、以下のようにします。
## URL for API Tokens
curl -v http://mysite.atlassian.net --user me@example.com:my-api-token
## URLs for API tokens with scopes for Jira and Confluence
curl -v http://api.atlassian.com/ex/jira/{cloudId} --user me@example.com:my-api-token
curl -v http://api.atlassian.com/ex/confluence/{cloudId} --user me@example.com:my-api-token
この例では、me@example.com
はトークンの作成に使用した Atlassian アカウントのメール アドレスです。
We use varied API token length rather than fixed length to ensure tokens are more secure and reliable. If your script relies on a fixed API token length, check that it can handle a variable length instead.
API トークンのスコープとは
The scope for an API token defines the levels of access to data in your Atlassian apps. When you create an API token, you choose the access level for the API token. When you select scopes for the token, you give the token permissions to perform certain actions. You can only select scopes for Jira and Confluence.
You can allow APIs to view, write, and delete content in Jira and Confluence.
This is the supported URL API calls: api.atlassian.com
Jira {{ http://api.atlassian.com/ex/jira/{cloudId}} または
Confluence {http://api.atlassian.com/ex/confluence/{cloudId}} のスコープ付き API トークンを使用するには、Atlassian API を呼び出す必要があります。
API を呼び出すリクエストを作成する方法
Jira public API | Confluence public API |
---|---|
|
|
API トークンの作成
API tokens with an infinite lifespan pose a data security risk. To improve data security, by default, we set API tokens to expire in one year. When you create an API token, you can name it and set the expiration date for the token.
When you create an API token for a service account, the service account can authenticate and run scripts for the apps you give them access to. When you create a token you must select scopes for the token.
To create an API token for a service account:
admin.atlassian.com に移動します。 複数の組織がある場合は、対象の組織を選択します。
Select Directory> Service accounts.
For the service account, select Actions > Create credential.
API トークンには、その機能を説明する名前を付けてください。
API トークンの有効期限を選択します。
トークンの有効期限は 1 〜 365 日です。
API トークンでアクセスするアプリを選択します。
スコープを選択して、API トークンが Jira または Confluence で実行できることを決定します。
[作成] を選択します。
[クリップボードにコピー] を選択してから、スクリプトにトークンを貼り付けるか、安全な場所に保存します。
You can't recover the API token after you’re done with this step. We recommend you save these best practices to keep your token safe:
API トークンをパスワード マネージャーに保存する。
You must create a service account before you can create a token for the service account.
API トークンを取り消す
When you revoke a token it no longer works and we permanently remove it from your account. If you revoke an existing API token, you can replace it with a new token. It takes up to 10 minutes for the token to be revoked.
API トークンを取り消すには、次の手順に従います。
admin.atlassian.com に移動します。 複数の組織がある場合は、対象の組織を選択します。
Select Directory> Service accounts.
For the service account, select Revoke.
この内容はお役に立ちましたか?