Asana PHP SDK doesn't support search functionality


#1

Hi,

Am I right that the search functionality is still not available in PHP SDK or I just didn’t find it?


#2

Correct, it’s not available in the currently released version of the client libraries. However, the next version of the client libraries will support the new search endpoint. In the meantime, you should be able to access this endpoint by manually calling getCollection as is done in the new source.


#3

Thank you, @Joe_Trollo.

I didn’t know about getCollection() so I’ve used get() directly. Is there any major difference between them?


#4

Yes, get() just executes a normal get request and returns the result. getCollection() on the other hand will wrap the result of get() in a custom implementation of PHP’s iterator interface that you can use in a foreach loop. This custom iterator will also automatically paginate for you, so instead of explicitly making one API request per page, you can make one API request for the entire collection and the client library will transparently make additional API requests to fetch more pages as you need them.


#5

Thank you @Joe_Trollo.


#6

The latest version of the PHP client library that was just released today (v0.8.0) supports the search endpoint through the $client->tasks->search(...) method.


#7

Thank you @Joe_Trollo! Nice!