- CheckMates
- :
- Products
- :
- Developers
- :
- API / CLI Discussion
- :
- Re: Can someone provide an API example that clearl...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can someone provide an API example that clearly shows the use of an element "List: string" type entry, like multiple domains in "add trusted-clients"
The API reference is missing a clear section that fully explains and provides examples for standard value types and entries, like "List: string", since none of the actual examples provided are sufficient, and there is no document or SK about the basic API elements.
Is a "List: string" a list of comma separated entries within quotes, is it a list of semi-colon separated entries within quotes, is it a list of quoted strings that are semi-colon separated?
- Tags:
- api
- list: string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It depends on the way you use the APIs.
When using web-services (REST) APIs:
The data is always sent using JSON format.
In JSON, arrays are passed using the [ ] characters.
When using command line:
Provide the members of the list as key value pairs. For example: param-name.0 value0 param-name.1 value1
Examples
The set-host command can accept a list of group names (list of strings) for its "groups" parameter.
When using REST, the same command would look like this:
POST {{server}}/set-host
Content-Type: application/json
X-chkp-sid: {{session}}
{
"name" : "my host"
"groups": [
"group0",
"group1"
]
}
When using CLI, the command would look like this:
mgmt_cli set-host name "my host" groups.0 "group0" groups.1 "group1"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's a good start, but does not illustrate how to create a list in a csv file for batch upload via -b option.
Currently, based on some examples I've found, it looks like the list is "a;b;c;d" with semi-color (;) as separator, but I need to verify that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
tried the method of "a:b:c" does not work. tried different ways, still not figure it out. anyone successfully know the syntax of multiple object?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll check this in code and get back to you.
Robert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Robert,
Thanks for reply. appreciate it. i am converting thousand rules from other brand to CP. it really makes me crazy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yansen,
Which brand are you migrating? Cisco? Juniper?
We have the SmartMove tool for that migration...
Robert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i am migrating from Cisco FWSM. it should be the same like ASA.
but if you can share the syntax format of list string in csv will be great. i already have the excel list source,destination and ports. the problem i can only import with single object as the syntax format i tried not correct
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here you go:
First, how does the CSV file is organized? The first row (the header) is a comma separated list of fields names, same as they appear in the specific command's parameters - please copy paste from the command refs to avoid typos.
Then, all the following rows just contain list of comma separated values.
In the case of list values, you should use the notation as Eugene Grybinnyk mentioned above. Let's take an example of add-host command:
In the header row you put the list fields names as follows -
groups.1,groups.2,etc
In the values rows, at the appropriate columns you put the corresponding values -
my_grp1,my_grp2,etc
BTW, you do not have to provide values to these fields in all values rows, as there may be hosts without groups...
Full example:
name,ip-address,color,groups.1,groups.2h1,1.1.1.1,red,my_grp1,my_grp2h2,2.2.2.2,yellow,my_grp1,my_grp2h3,3.3.3.3,black,my_grp1,h4,4.4.4.4,orange,,
On the second hand, when you want to modify existing host objects (set-host command), sometimes you wish to add values to the list, or sometimes reset or remove the values. In this case you shoud use "add" or "remove" keywords. For a complete samples, take a look at the examples section of this command -
https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/set-vpn-community-star~v1.1%20
Hope this helps.
Robert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Robert for your valuable inputs. i can import multiple objects now. but i need to adjust my csv list. i thought it can be done in column Format but it is not. i need to convert like source.1,source.2, source.3
