You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2023-12-07 15:17:13

JAssfalg
Member
Registered: 2023-06-16
Posts: 8

GLPI Proxy local file

Hello together,
my GLPI Agent Proxy runs and save the computer as a json file in a directory.

I want to manually with python update this computer which link i had to use ?

I am successfully login the api.

Here the beginning of my json file
----------------------------------

{
   "action": "inventory",
   "content": {
      "accesslog": {
         "logdate": "2023-12-07 08:34:34"
      },
      "antivirus": [
         {
            "base_version": "1.4

---------------------------------------------

Here my python code.

with open(self.directory_path + "/" + file_name, "r") as file:
                json_computer = json.load(file)

            json_data = {
                'input' : json_computer
            }

            response = requests.post(self.link_server + "Computer", headers=self.headers, json=json_data)


            if response.status_code == 201: 
                print("Data sent successfully.")
                print(f"Error: {response.status_code} - {response.text}")
            else:
                print(f"Error: {response.status_code} - {response.text}")

------------------------------

I get the error 200 ? but my computer issent up to date

lg Joachim

Offline

#2 2023-12-07 16:40:27

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,813
Website

Re: GLPI Proxy local file

You cannot update computer data through the API using the GLPI Agent inventory file.
Inventory files must be submitted to "/front/inventory.php".


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#3 2023-12-08 11:08:26

JAssfalg
Member
Registered: 2023-06-16
Posts: 8

Re: GLPI Proxy local file

Thank you very much for the reply.
okay is there a another method to update the inventory over a another method to update with the local inventory file of the proxy ?


Thank you very much.

Offline

Board footer

Powered by FluxBB