I am reading the task list for a project, but I noticed that the 'gid' for the issue is changing. Why?

url=‘https://app.asana.com/api/1.0/tasks
headers={‘Authorization’: ‘Bearer token’, ‘Content-Type’: ‘application/json’}
params = {‘project’: ‘gid of project’}
data = {}
r = requests.get(url, params = params,json = data, headers=headers)

I get an answer:
{‘data’: [{‘gid’: ‘1147855851142160’,
‘name’: ‘my_task_01’,
‘resource_type’: ‘task’},

But the next time you run the script, the gid for the task changes.
{‘data’: [{‘gid’: ‘1147855851142162’,
‘name’: ‘my_task_01’,
‘resource_type’: ‘task’},

Why isn’t the gid static?

The GID is definitely static and unique. You can get it from the URL when in Asana, it’s the last part. Is any of those two numbers is the right one?

Yes, the latter is correct. Obviously, there was a mistake in saving the access codes (rounding).

Thanks for the answer!

1 Like