Workspace project API get blank data response

Hello,

I am using below workspace API to get all projects in one workspace, but there is no data returned even there is project in the workspace, also I created the project in the UI, so the personal token should be fine.

https://app.asana.com/api/1.0/workspaces/:workspace_gid/projects

If I use project API, I can get the workspace gid in the response.

https://app.asana.com/api/1.0/projects/:project_gid?opt_fields=workspace,custom_fields.date_value.date_time

Could you help check what might be the reason why it has no project data returned for the workspace API?

Thanks!

That’s odd, I can’t offhand think of why that endpoint would not be returning any data. Do you get any type of error, or just an empty array? Can you post your code; maybe we can spot an issue there?

I normally used Postman for testing first,

the python code is as below,

import requests

url = “https://app.asana.com/api/1.0/workspaces/20105541092398/projects

payload = {}
headers = {
‘Accept’: ‘application/json’,
‘Authorization’: ‘Bearer token’
}

response = requests.request(“GET”, url, headers=headers, data=payload)

print(response.text)
image