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

API call show-access-rulebase dies after 4 iterations getting 50 rules at a time

I am using script to export a ruleset.

when I run it I get:


Checking existence of package [Border_Policy]

Exporting Access Control layers

Exporting Access Layer [Border_Policy Security]

Getting layer information for layer [Border_Policy Security]
Getting information from show-access-rulebase
Retrieved 50 out of 688 rules (7%)
Retrieved 100 out of 688 rules (14%)
Retrieved 150 out of 688 rules (21%)
Retrieved 200 out of 688 rules (29%)

Traceback (most recent call last):
  File "", line 44, in <module>
    export_package(client, args)
  File "/Users/rful011/src/ExportImportPolicyPackage/exporting/", line 39, in export_package
    = export_access_rulebase(["name"], access_layer["name"], access_layer["uid"], client, timestamp, tar_file)
  File "/Users/rful011/src/ExportImportPolicyPackage/exporting/", line 16, in export_access_rulebase
    get_query_rulebase_data(client, "access-rulebase", {"name": layer, "uid": layer_uid, "package": package})
  File "/Users/rful011/src/ExportImportPolicyPackage/exporting/", line 64, in get_query_rulebase_data
    for rulebase_reply in rulebase_replies:
  File "/Users/rful011/src/ExportImportPolicyPackage/cpapi/", line 414, in gen_api_query
    raise APIException(api_res.error_message,
cpapi.api_exceptions.APIException: APIResponse received a response which is not a valid JSON.

Following this the API is unresponsive and needs to be restarted on the server.  All API calls get 503 errors.

This feels like some sort of resource exhaustion on the server end.

Any suggestions on how to diagnose what is wrong?  Or ways to work around the issue?   I have considered getting the script to process fixed ranges of rules for each run.





0 Kudos
4 Replies

0 Kudos

I don't have permission to view solution to that post but it looks like the right problem.  I actually solved it by reducing the number of objects retrieved from 50 to 20.  Odd that it dies after 4 successful calls.

0 Kudos

How you change the number of objects retrieved from 50 to 20? I'm with the same problem on R81

0 Kudos

That would be changing the relevant API call so that includes a limit 20 as one of the options.

However, it’s probably worth a TAC case if only to get to the bottom of the underlying issue with the API.

0 Kudos


Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events