Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Joshua_Boerum
Participant
Jump to solution

R80 API - Create multiple objects JSON

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

0 Kudos
1 Solution

Accepted Solutions
Uri_Bialik

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

View solution in original post

0 Kudos
(1)
1 Reply
Uri_Bialik

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)

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events