Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Rest API to generate User Tokes

Rajat Roy February 19, 2024

Hi , 

Is there any rest API provide by Bamboo so that users can generate Auth Tokens for their service accounts ? 

 

Thanks !!! 

1 answer

2 votes
Hariharan Iyer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 19, 2024

Yes, bamboo does provide REST APIs  - https://developer.atlassian.com/server/bamboo/rest-apis/

Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 19, 2024
Rajat Roy February 19, 2024

how to pass the username in the url in order to generate the token for GET request

 

Hariharan Iyer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 19, 2024

Ho @Rajat Roy ,

Please check the "Using the Bamboo REST APIs" section - https://developer.atlassian.com/server/bamboo/using-the-bamboo-rest-apis/

 

You will need to get your Personal Access Token from the UI. There's no way to get that via API.

Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 19, 2024

@Rajat Roy 

It's for the current user you are requesting the token.

Rajat Roy February 19, 2024

Yeah , we use OIDC , so service accounts cant login via the UI to generate tokens . So we were looking for an option to generate it for these accounts via some API . 

Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 19, 2024

Hello @Rajat Roy 

You can use the below to generate token for the service account, you need to have the credential details of the service account, otherwise it won't be possible.

User including Admins cannot generate PAT tokens for other users. Admin users can only revoke tokens of other users. 

curl --request POST \
--user serviceaccount_user_id:serviceaccount_password \
--url 'http:localhost:8085/rest/api/latest/access-token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"name": "token name",
"permissions": [
"READ"
]
}'

Regards,

Shashank kumar

**please don't forget to Accept the answer if your query was answered**

 

Like # people like this
Ayrijit Swain
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 20, 2024

@Rajat Roy  to add to @Shashank Kumar 's answer the valid values for permissions parameter are:

READ - The token will be allowed to read data from Bamboo.

TRIGGER - Allows the token to trigger builds and deployments.

USER - The token will have the same permissions as the service account.

Like Shashank Kumar likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events