Forums

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

Why am I getting different project information via rest/api (OAuth2) and via rest/api APIKEY

Damon Curnell
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!
June 3, 2025

From my browser I can post https://<site.domain>/rest/api/3/project/search/action=view
And it returns a pagenated list of projects. 

{
  "self": "<site.domain>/rest/api/3/project/search?maxResults=50&action=view&startAt=0",
  "nextPage": "https://<site.domain>/rest/api/3/project/search?maxResults=50&action=view&startAt=50",
  "maxResults": 50,
  "startAt": 0,
  "total": 66,
  "isLast": false,
  "values": [


From my linux workstation which is behind corporate firewall and is attached via proxy it returns

{
  "self": "https://<site.domain>.net/rest/api/3/project/search?maxResults=50&action=view&startAt=0",
  "nextPage": "https://<site.domain>/rest/api/3/project/search?maxResults=50&action=view&startAt=50",
  "maxResults": 50,
  "startAt": 0,
  "total": 0,
  "isLast": true,
  "values": [

 I am have ORG ADMIN privs and granted my self every privilege for the site added myself to all the groups,  have the site configured in ip allow list.  I have created both an apikey with scopes and without scopes and I am now confused because this use to work.

from datetime import datetime
import requests

# Proxy configuration
proxies = {
"http": "http://<proxyhost>:<proxyport>",
"https": "http://<proxyhost>:<proxyport>"
}


# Authentication (replace with your credentials or token)
AUTH_HEADER = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Credentials"
}

 

# Function to fetch paginated data

while not is_last:
url = f"{host}/rest/api/3/project/search"
params = {

"action": "view",
"maxResults": max_results,
"startAt": start_at
}

response = requests.get(url, headers=AUTH_HEADER, params=params, proxies=proxies)
if response.status_code < 300:
data = response.json()
all_results.extend(data.get("values", []))
start_at += max_results
is_last = data.get("isLast", True)
else:
print(f"Failed to fetch data from {host}. Status code: {response.status_code} {response.json}")
break

return all_results

 

1 answer

0 votes
Piyush Annadate _ACE Pune_
Community Champion
June 3, 2025

Hello @Damon Curnell 
Welcome to the Community !
Both the APIs' are of same account?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
TAGS
AUG Leaders

Atlassian Community Events