I’ve created a powershell script that extracts our azure AD and import all the users as costumers in our service desk.
In this script I use 2 api’s. One api adds the costumer to our Jira. And the other adds that costumer to a specific service desk.
For the first I use this api:
Invoke-RestMethod -Uri "https://***.atlassian.net/rest/api/2/user?username=$($s.UserPrincipalName)" -ContentType "application/json;charset=UTF-8" -WebSession $mysession
This api works fine.
And for the second I use this api:
Invoke-RestMethod -Method Post -Uri https://***.atlassian.net/rest/servicedeskapi/servicedesk/6/customer -Body $body -ContentType "application/json;charset=UTF-8" -WebSession $mysession
This api works fine once or twice. But after I loop more then 2 time through this api. I get a time-out error. I’ve sent this to support and after a few tries we saw that if my request goes through, it succeeds. But after 2 times my request doesn’t go through anymore.
When support tries my script in bash it works fine. So is there any known problem with powershell and those api’s? Because I need to do this in powershell.