+1

Search Item by label via API without folderID

jbperrin 10 months ago • updated by Steve Shipway 6 months ago 3

Hi there !


First of all , I need to tell you that we save a lot of time thanks to your password manager !


Thanks you for that


We want to gain more time by the way of the automation and the teampass API .


But we have a lot of folder , order by business/Job/Envireonnement/etc..


It's difficult for us to loop throught it via the API .


May you can add some new function to the API to find a item by label without folder ?


I change the code in our own version to test my thought , and it works as expected.


I just clone the parts :


           if ($GLOBALS['request'][1] == "item") {
                /*
                * FIND ITEMS in FOLDERS
                */


in the file /var/www/teampass/api/functions.php


I comment every place i've found the array_category .


I name it "itembyname" .


Is it possible to add this function to our next release ?


Regards


PS : don't hesitate to answer in french ;)

Even better , search by description / label / login / etc ...

This could be problematic if a search matches more than one item.

Maybe, have an API search function that returns a list of fully-qualified items names (IE with path and everything) so that a second call can be made to retrieve whichever one is required?


(This is the way the equivalent calls in Thycotic's SecretServer do it)

Another variant on this, would be to have the option to search a folder and every folder below it. Currently you need to know the actual folder numbers for all folders.


You could also take a missing pattern to mean 'all', a zero folder to mean 'all', and allow a name for the folder (in which case it would be searched for)


e.g.

/find/item/1;2;3/foo?apikey=X  : find all items containing 'foo' under folder 1, 2 or 3

/find/item/0/foo?apikey=X : find all items containing 'foo' in any folder

/find/item/3/foo/recurse?apikey=X : find all items contiaing 'foo' in folder 3 or any folder under it

/find/item/bar/foo?apikey=X : find all items containing 'foo' in the folder with name 'bar'

/find/item/1?apikey=X : find all items in folder 1