Hi,
I want to get asana project templates using API.
The code is working for certain clients (asana accounts), but not for others.
Clients are in paid plans and have all the project/template permissions.
here is the piece of code:
async getTemplates( workspaces:Array ): Promise<Array> {
let templates:Array = ;
for (let i=0; i<workspaces.length; i++) {
const foundTemplates = await this.getAllByGid(workspaces[i].gid, this.requestTemplates.bind(this));
if (foundTemplates?.length) {
templates = templates.concat(foundTemplates);
} else {
await this.teamService.setUser(this.user);
const teams: Array = await this.teamService.getTeamsByWorkspace(workspaces[i].gid);
for (let k=0; k<teams.length; k++) {
const templatesByTeam: Array = await this.getAllByGid(teams[i].gid, this.requestTemplatesByTeam.bind(this));
if (templatesByTeam?.length) {
templates = templates.concat(templatesByTeam);
}
}
}
}
return templates.filter((el:IAsanaBaseAnswer, index:number, self:IAsanaBaseAnswer) =>
self.map((v:IAsanaBaseAnswer) => v.gid).indexOf(el.gid) === index
);
}
Here is the error message.
{“errors”:[{“message”:“You do not have access to this team.”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: Asana”}]}
Could you please help? is there any other way to get project templates using API?
Thank you for your help
Lamine