added a method to get search options for items
This commit is contained in:
14
GLPIAPI.py
14
GLPIAPI.py
@@ -174,7 +174,19 @@ class GLPIAPI:
|
|||||||
return userID, search["data"], search["totalcount"]
|
return userID, search["data"], search["totalcount"]
|
||||||
|
|
||||||
return None, None, 0
|
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):
|
def UploadFile(self, file, path):
|
||||||
manifest = {
|
manifest = {
|
||||||
"input": {
|
"input": {
|
||||||
|
|||||||
Reference in New Issue
Block a user