Updated SetDocumentToDevice to SetDocumentToItem and added a parameter to set itemType

This commit is contained in:
2026-03-18 20:20:36 +01:00
parent ebac45944b
commit 11b2b61aac

View File

@@ -160,12 +160,12 @@ class GLPIAPI:
files = {file: fileData}
return requests.post(self.Server+"/apirest.php/Document/", headers=headers, data=data, files=files)
def SetDocumentToDevice(self, deviceID, documentID):
def SetDocumentToItem(self, itemID, itemType, documentID):
body = {
"input": {
"documents_id": documentID,
"items_id": deviceID,
"itemtype": "Computer"
"items_id": itemID,
"itemtype": itemType
}
}
return requests.post(self.Server+"/apirest.php/Document/"+str(documentID)+"/Document_Item", headers=self.Headers, json=body)