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

R80 API - Create multiple objects JSON

Jump to solution

Looking at the API for add-host. What is the proper syntax to add multiple hosts in one payload rather than just one at a time?

Example:

add one host

{

     "name" : "New Host 1",

     "ip-address" : "192.0.2.1"

}

add multiple hosts

[

   {

        "name" : "New Host 1",

        "ip-address" : "192.0.2.1"

   },

   {

        "name" : "New Host 2",

        "ip-address" : "192.0.2.2"

   }

]

The above gives the following error:

Can not deserialize instance of com.checkpoint.management.web_api.core.handler.objects.network_objects.host.HostRequestNew out of START_ARRAY token

Tags (4)
0 Kudos
1 Solution

Accepted Solutions

Re: R80 API - Create multiple objects JSON

Jump to solution

Unfortunately, you can't make multiple objects with a single API call, you have to call "add-host" API for every object.

When using the mgmt_cli instead of web-services, it is possible to pass a csv file and create multiple objects with one CLI command.

Behind the scenes, when mgmt_cli is processing the csv file, it makes multiple API calls.

Uri

0 Kudos
1 Reply

Re: R80 API - Create multiple objects JSON

Jump to solution

Unfortunately, you can't make multiple objects with a single API call, you have to call "add-host" API for every object.

When using the mgmt_cli instead of web-services, it is possible to pass a csv file and create multiple objects with one CLI command.

Behind the scenes, when mgmt_cli is processing the csv file, it makes multiple API calls.

Uri

0 Kudos