added a method to get search options for items
This commit is contained in:
12
GLPIAPI.py
12
GLPIAPI.py
@@ -175,6 +175,18 @@ class GLPIAPI:
|
||||
|
||||
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": {
|
||||
|
||||
Reference in New Issue
Block a user