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

API Syntax

Hi,

I have searched high and low but cannot find any descriptions of the syntax for the API. I have seen the API Reference and understand the concept of "key" "value" pairs and what a "string" or "Boolean" value is. What I am looking for is what happens when the "key" refers to an "Object" or a "List: Object", particularly when using "set-xxx".

What started me down this path is the desire to simplify overriding the actions for IPS protections for one profile. I could ask if anyone has done anything like this but I really want to understand the API so I can start automating/simplifying repetitive tasks.

Colin

0 Kudos
3 Replies
PhoneBoy
Admin
Admin

When you make a call to the API, you are passing a JSON object.
A JSON object is an unordered set of name/value pairs.
An object begins with a left brace '{' and ends with a right brace '}'.
Each name is followed by a colon ':' and the name/value pairs are separated by a comma ','.
More about JSON in general here: https://www.json.org/json-en.html

Even if you're using mgmt_cli to talk to the API, the underlying API call happens in JSON.
That might require some specific syntax if you use mgmt_cli.
A couple threads might be helpful here:
https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Adjust-Threat-Protection-Action/m...
https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Intermittent-error-for-web-api-se...
0 Kudos
Colin_Campbell1
Contributor

Hi,

I was initially not overly enamored with this response but then re-acquainted myself with the JSON page and it became much clearer. Kind of "give a man a fish and feed him for a day; teach a man to fish and feed him for life". Thanks for the fishing rod.

Colin

0 Kudos
PhoneBoy
Admin
Admin

What I probably should have added to the above is that sometimes a value is, itself, a JSON object.
Nested JSON is where I occasionally get confused at times.
0 Kudos