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-01-31 17:42:22

zerg_playa
Member
Registered: 2023-01-31
Posts: 1

glpi.updateObjects - Missing parameter (fields)

Hello GLPI community, hope to get some help here with my GLPI struggles. Currently I'm creating python module to mange glpi (create tickets,update objects,list users and so on). I'm able to authenictate to GLPI, check status, listNetworks and various other things so this works fine. I have also write access on my user ( tested already ). I'm now working on updating objects via restphp.php plugin. Do you maybe know why I'm getting missing fields errors? I've tried numerous payload combinations. My python code:

  glpi_fields = {
            'Computer': [
                {
                    'id': '3274',
                    'name': 'new_name_write_api_test',  # this is new name I want to give to Computer
                }
            ]
}
            params = {
                       "login_name":login_name,
                       "login_password":login_password,
                       "fields":glpi_fields,
                       "method":"glpi.updateObjects",
                       "Content-Type": "application/json"
                     }

            cookies = {session_id:session_token}
            response = requests.post(GLPI_URL,
                                params=params,
                                cookies=cookies,
                                verify=False)

            return response.content


Error is:
b'{"faultCode":11,"faultString":"Missing parameter (fields)"}'


update: I've solved the issue, turned out FIelds value was incorect. Correct format is the one that GLPI is returing via getObjects. Now I have another issue. I try to update my test Computer, but
when I run glpi.updateObjects I recieve empty response and object is not update. Response :

b'[]'     #empty arrray

What could be reason that I dont any error but object is not being updated? Cheers!

Last edited by zerg_playa (2023-02-01 22:05:09)

Offline

Board footer

Powered by FluxBB