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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.