node-asana
node-asana copied to clipboard
projects.findByWorkspace() not working for personal projects
projects.findByWorkspace(ID-of-personal-projects-workspace) is timing out with an http 504.
But a GET to https://app.asana.com/api/1.0/workspaces/ID-of-personal-projects-workspace/projects/ in my browser or curl is working fine.
Using API key and basic authentication I tried with two different accounts and got same result
Hi Marc. Thanks for reporting; the reason is pagination. It's a known issue that you cannot paginate through personal projects, and the client library always paginates by default (because it's a best practice—at some point in the future we will remove the ability to make unpaginated requests).
I'm going to leave this issue open since it is outstanding. The workaround would be to get the client library to issue a non-paginated request, which you should be able to do by explicitly passing a limit: 0 query parameter.
I'm having a similar issue - even when I explicitly pass { limit : 0 } I always get the response Error: Cannot create Collection from response that does not have resources, after a several second delay. No problems with non-personal workspaces.
I can get my personal projects with curl using https://app.asana.com/api/1.0/workspaces/[my-personal-project-id]/projects.
Ok, I apologize, the way the code works limit: 0 won't actually provide no limit. Our intention is to move towards all requests being paginated, which means we're trying not to facilitate such requests through the client libraries. This will eventually either mean updating our backends to properly achieve pagination through the required resource, or removing such capabilities through the API. We hope we're able to do the former with personal projects; we'd definitely provide you with some advance notice if we went the latter route.
That said, in the meantime, a real workaround would be to use the Dispatcher directly, e.g.:
var response = client.dispatcher.get('/workspaces/123/projects')
@slobak Thanks - I'll use the dispatcher directly.
+1
@slobak Does asana still have this issue on its backend? Is there a way to find out if a project is personal or not by using the API?