Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Get users in organization via Powershell

Does anyone have a existing way to do the API call 'Get Users in Organization' via powershell? I tried JiraPS but that can only give me group members and its just their name where as this gives ID, timezone and email etc.

Otherwise does someone have an idea how to connect? Seems to be totally different to how i connect to insight in my InsightPS module.

 

 

 

2 answers

1 accepted

0 votes
Answer accepted
$username = "email address"
$password = "api key"

$ServiceDeskID
 = "Service Desk Number"
$Server = "jira server url"

# Convert the username + password into a Base64 encoded hash for basic authentication
$pair = "${username}:${password}"
$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
$base64 = [System.Convert]::ToBase64String($bytes)
$headers = @Authorization = "Basic $base64" }
$headers.Add('content-type' , 'application/json')
$headers.Add('X-ExperimentalApi' , 'opt-in')

$start
 = 0
$limit = 50 #Max results

$Customers = @()

$Customers = do {    
$URL = [System.UriBuilder]"$Server/rest/servicedeskapi/servicedesk/$ServiceDeskID/customer?limit=$limit&start=$start"    
$Response = Invoke-RestMethod -Uri $URL.Uri -Headers $headers -Method GET    
$Response.values
$start += $limit
until (
$Response.isLastPage -eq $true)

My issue was just with that API call. Seems to be fine for all others and turns out that wasn't what i wanted anyway. 

All the examples that I can find use Basic auth which doesn't work anymore.

Do we need to generate a JWT header or can we just provide username\APIkey?

Any help to point me in the right direction would be helpful.

Suggest an answer

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

ThinkTilt is joining the Atlassian Family!

This morning, Atlassian announced the acquisition of ThinkTilt , the maker of ProForma, a no-code/low code form builder with 700+ customers worldwide. ThinkTilt helps IT empower any team in their or...

852 views 30 33
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