cancel
Showing results for 
Search instead for 
Did you mean: 
Post a Question

vSEC REST API bulk import of object

Hi All,

I was successful in adding host object using REST API 'create-host' call

however, it allows me to add only one object at a time, does anyone know a method of adding bulk import of objects at the same time.

Please let me know

Thanks,

Chandru Saravanan

0 Kudos
4 Replies
Admin
Admin

Re: vSEC REST API bulk import of object

Via the CLI, you can do it via a single command using a CSV file.

However, this ultimately calls the REST API multiple times, one for each line.

Either way, the objects don't become active until you publish the changes (another API call).

What's the use case for creating multiple objects using a single API call? 

0 Kudos

Re: vSEC REST API bulk import of object

Thanks Dameon for the reply. I have a list of objects I wanted to upload to management server

I am using the following powershell script to create-host object

  • $headers = @{
          "Content-Type" = "application/json"
          "X-chkp-sid" = $sid
     }
    $CreateHost =@{
            "name" = "MyHost3"
            "ip-address" = "192.0.2.14"
     }
    $CreateHost = $CreateHost | ConvertTo-Json
    $response = Invoke-RestMethod -Method Post -Headers $headers -Uri $URLAnon -Body $CreateHost
    It creates the host fine, however I couldn't add multiple $CreateHost variables at the same time. 
    I thought, if there was an other method I was missing. Its been a while I coded, but your reply gave me the idea. 
    I will have all the objects to import in a .CSV file, and then create a "for" loop to call the CreateHost url and then finally publish it
0 Kudos

Re: vSEC REST API bulk import of object

Check out psCheckPoint as PowerShell Module.

It works great on batches.

0 Kudos

Re: vSEC REST API bulk import of object

Thanks Hugo. Will check it out

0 Kudos