Fix MAJ GLPI magenta link
This commit is contained in:
@@ -109,18 +109,38 @@ class GLPIAPI:
|
||||
}
|
||||
}
|
||||
uri = f"{self.Server}/apirest.php/Computer/"
|
||||
return requests.put(uri, headers=self.Headers, json=body)
|
||||
return requests.put(uri, headers=self.Headers, json=body)
|
||||
|
||||
def UpdateAirwatchLink(self, deviceid, airwatchlink):
|
||||
|
||||
body = {
|
||||
"input": {
|
||||
"id": deviceid,
|
||||
"appareilsurmagentafield": airwatchlink
|
||||
}
|
||||
}
|
||||
uri = f"{self.Server}/apirest.php/Computer/"
|
||||
return requests.put(uri, headers=self.Headers, json=body)
|
||||
uri = f"{self.Server}/apirest.php/PluginFieldsComputermdt"
|
||||
searchURI = f"{self.Server}/apirest.php/PluginFieldsComputermdt?range=0-999999999"
|
||||
result = requests.get(searchURI, headers=self.Headers)
|
||||
if(result.status_code == 200):
|
||||
result = result.json()
|
||||
fieldItem = None
|
||||
# searching for field item
|
||||
for entry in result:
|
||||
if str(entry["items_id"]) == deviceid:
|
||||
fieldItem = entry
|
||||
|
||||
if(fieldItem == None):
|
||||
body = {
|
||||
"input": {
|
||||
"items_id": deviceid,
|
||||
"itemtype": "Computer",
|
||||
"plugin_fields_containers_id": 4,
|
||||
"appareilsurmagentafield": airwatchlink
|
||||
}
|
||||
}
|
||||
return requests.post(uri, headers=self.Headers, json=body)
|
||||
else:
|
||||
body = {
|
||||
"input": {
|
||||
"id": fieldItem["id"],
|
||||
"appareilsurmagentafield": airwatchlink
|
||||
}
|
||||
}
|
||||
return requests.put(uri, headers=self.Headers, json=body)
|
||||
|
||||
def CreateInventoryForAirwatchDevice(self, device, deviceName, apps=None):
|
||||
platforms = {
|
||||
|
||||
Reference in New Issue
Block a user