Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Chandhrasekar_S
Collaborator

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
PhoneBoy
Admin
Admin

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
Chandhrasekar_S
Collaborator

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
Hugo_vd_Kooij
Advisor

Check out psCheckPoint as PowerShell Module.

It works great on batches.

<< We make miracles happen while you wait. The impossible jobs take just a wee bit longer. >>
0 Kudos
Chandhrasekar_S
Collaborator

Thanks Hugo. Will check it out

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events