Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using API I receive a 401 error on 2nd request

Brian Gibson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 27, 2022

I am trying to retrieve a list of our users from our Jira Server instance.   I have no problem with the first request for the 1000(hard limit of 1000 on Jira server) but when I iterate through for my second request I get a 401 error saying I am unauthorized.   I have never had this issue in the past. 

```

emails = []
range = [0, 1000]
session = requests.Session()
for ind in range:
tgt = "https://host.example.com/rest/api/2/user/search?username=.&start-index=" + str(ind) + "&maxResults=1000"
print(tgt)
response = requests.get(tgt, headers=headers,auth=HTTPBasicAuth(user, pwd))
print(response.headers)
result = response.json()

```

Any help would be much appreciated.   This is pretty simple stuff.

0 answers

Suggest an answer

Log in or Sign up to answer