From 3d920fd5e57c44305a1da7b034c3f4c73632d0e3 Mon Sep 17 00:00:00 2001 From: Jason Secula Date: Sat, 28 Mar 2026 18:15:14 +0100 Subject: [PATCH] added a method to get search options for items --- GLPIAPI.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/GLPIAPI.py b/GLPIAPI.py index 18fafd8..4e380d2 100644 --- a/GLPIAPI.py +++ b/GLPIAPI.py @@ -174,7 +174,19 @@ class GLPIAPI: return userID, search["data"], search["totalcount"] return None, None, 0 - + + def GetSearchOptions(self, itemType, fieldName=None): + queryUri = f"{self.Server}/apirest.php/listSearchOptions/{itemType}" + searchOptions = requests.get(queryUri, headers=self.Headers) + if(searchOptions.status_code == 200): + searchOptions = searchOptions.json() + if(fieldName != None): + for k,v in searchOptions.items(): + if(v['name'].lower() == fieldName.lower()): + return {k : searchOptions[k]} + return searchOptions + return searchOptions.status_code + def UploadFile(self, file, path): manifest = { "input": {