Python client library: get all projects list

Hello everyone.

I find it difficult to see the whole list of methods from the Python client library.
For instance, the API has an endpoint for getting the list of projects which can be accesed via https://app.asana.com/api/1.0/projects.

I can’t find specific documentation for the Python client. Where can I see the full list of methods? I am just trying to achieve the same purpose as with the plan endpoint, but I don’t know what method I should use or how.

None of these work as expected:
client.projects.get_projects()
client.projects.find_all()

The endpoint does not require to pass any workspace. Why does the Python wrapper force it?

Hi @Felix_Daniel ,welcome to the forum!

First, I don’t use Python, but there’s some details I can help you with.

First, the “/projects” endpoint, seems to work without parameters, but when you have too many projects, it doesn’t work and returns an error asking to use pagination (limit + offset parameters).

When you add the “limit” parameter, there’s a validation asking to add mandatory workspace_id parameter.

So, I suppose that the Python client is using the “limit + offset” parameters to manage pagination, that’s why you need to add a mandatory workspace_id.

For the documentation, the list of functions is available at the same place you get the “endpoint” documentations, but you can switch the sample language to “Python” on the right, and you see the functions name, in the sample block.

But, I must admit that the code samples are not really helpful!
Most of the time, it’s “param” = “value” !!

You can take a look at the GitHub repository for python client, when you open the files, you can see all the functions.

2 Likes

Thanks, @Frederic_Malenfant

I ended up using the search API since I was looking for a way of getting the list of completed tasks. And it turns out that the search endpoint gives me a way much quicker access to that, because I don’t need to iterate over the list of projects, which speeds everything up.

Now I have another problem regarding search API, but I will create a new thread for it.

Thanks!

1 Like