Is there a way to create a project using a template in Python? Or a way to duplicate a project from python?
My goal is to set up a new environment in Asana for the next year based on a template I made. I first thought was to copy the JSON structure of the project I created and loop it 200 times while changing the project name from a. But when I used client.projects.find_by_id, it did not give me tasks or sections.
Can you advise on possible solutions to this?
Hi @Revanth_Chintala and welcome to the forum!
You donāt need to do it manually or loop or anything - there is an API function to duplicate a project:
This endpoint is in the Python client library.
1 Like
Thanks a lot! Here is my rough solution, if anyone in the future has a similar issue:
headers = {
āContent-Typeā: āapplication/jsonā,
āAcceptā: āapplication/jsonā,
āAuthorizationā: āBearer access tokenā,
}
data = {
ādataā: {
ānameā: "New Project ",
āteamā: testing_team_id,
}
}
response = requests.post(āhttps://app.asana.com/api/1.0/projects/proj_id/duplicateā, json = data, headers=headers)
for x in response:
print(x)