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

Python SDK where-used query

Jump to solution

Hello all,

I try to make python script using cpapi SDK.

When i try to run a where-used command i have an error

Code : 
       where_used = client.api_query("where-used","standard",payload={"name" : "dummy"})
        if  where_used.success is False:
            print("Failed:\n{}".format(where_used.error_message))
            exit(1)
        print(where_used)
 
Result : 
Failed:
code: generic_err_invalid_parameter_name
message: Unrecognized parameter [limit]
 
And indeed in Json request i have this, seems that limit parameter is added somewhere on the SDK
 
"request": {
"headers": {
"Accept": "*/*",
"Content-Length": 72,
"Content-Type": "application/json",
"User-Agent": "python-api-wrapper",
"X-chkp-sid": "I9L3kLZoRAVLTC_KVoD-KD3mu8oKhE6QlX4TJCQyIxs"
},
"payload": {
"details-level": "standard",
"limit": 50,
"name": "dummy",
"offset": 0
},
"url": "/web_api/v1.8/where-used"
},
"response": {
"data": {
"code": "generic_err_invalid_parameter_name",
"message": "Unrecognized parameter [limit]"
},
"status_code": 400
 

 

Should i use wrong parameters in client.api_query ?

Thanls for your help

 

 

 

0 Kudos
1 Solution

Accepted Solutions
Julien_Matray
Participant

In fact the "where-used" command does not have a limit parameter (https://sc1.checkpoint.com/documents/latest/APIs/?#web/where-used~v1.8%20), and with the SDK function  api_query a limit parameters is automatically added. That's why it failed

But the SDK function api_call nothing is added so i have no issue with that

View solution in original post

0 Kudos
3 Replies
PhoneBoy
Admin
Admin

@chkp-royl you familiar with this?

0 Kudos
Stuart_Green1
Employee
Employee

Limit has a default value of 50 with the Python API (https://github.com/CheckPointSW/cp_mgmt_api_python_sdk/blob/b2d0a232b8e6689485799f97a25b475a2fd15d55...) but you can override it as part of your payload by setting limit=[value]. Can you share a copy of the HTTP request? 

0 Kudos
Julien_Matray
Participant

In fact the "where-used" command does not have a limit parameter (https://sc1.checkpoint.com/documents/latest/APIs/?#web/where-used~v1.8%20), and with the SDK function  api_query a limit parameters is automatically added. That's why it failed

But the SDK function api_call nothing is added so i have no issue with that

0 Kudos