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 2020-07-08 14:36:56

Chop
Member
Registered: 2020-07-06
Posts: 4

Add network card to computer

Hi,

I'm trying to add an existing network card to an existing computer through the API with powershell

So i'm making a POST request like so :

$url = "http://$serverip/glpi/apirest.php/Computer/7370/Item_DeviceNetworkCard"

$data = @{
        "items_id" = "7370"
        "itemtype" = "Computer"
        "devicetype"= "DeviceNetworkCard"
        "devices_id" = "3"
        "new_devices" = "0"
        "items_devicenetworkcards_id[]" = "3"
}

$ArrayList.add($data) > $null

$Body = '{ "input": ' + ($ArrayList | ConvertTo-Json )+ '}'

Invoke-RestMethod -Uri $url -Method POST -Headers $headers -Body $Body

I get the following error message regarding permissions...

Invoke-RestMethod : ["ERROR_GLPI_ADD","Vous n'avez pas les droits requis pour réaliser cette action."]

I can't find much information about it and can't figure out if my data structure is wrong or the url.

Thanks for future help ! (hopefully smile

Offline

Board footer

Powered by FluxBB