Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to use current user to run api calls on postfunction?

Hi Team,

Im trying run an api call from the postfunction to get fields data. but the downside is we cant use the hard coded / basic auth due too restrictions. can we make use of current user to run the API.

1 answer

0 votes
Pramodh M Community Leader Jan 07, 2022

Hi @Gagan 

Use ComponentAccessor to get logged in user and IssueManager to perform any activity on Issue using that user who is performing either transition or any relevant action.

https://community.atlassian.com/t5/Jira-questions/How-to-get-current-user-in-jira-application/qaq-p/818002

Thanks,
Pramodh

Hello @Pramodh M ,

i need to get the json of the fields data (like type etc) which we get from /rest/api/2/field.

But to do so it needs authentication and for the auth i need to make use current user. as this call is run by admins only.

i cannot hard code the creds to the code.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

634 views 21 26
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you