Forum Discussion

Phil's avatar
Phil
Icon for Joining the Conversation rankJoining the Conversation
7 months ago
Solved

Pull network rules via API

Hi community, I am trying to pull network settings for several sites.  To be more precise, I would like to create a list of bypass rules per site. I tried the following query with empty results: q...
  • Brian-Anderson's avatar
    2 months ago

    Hi,

    It looks like your query is looking to filter results for a specific site, where the siteId is 0.  This would not be a valid site ID which is why the results would not return any records.  You actually don't need to submit the parent, and you will get back all of the site records this way. 

    Query:
    query entityLookup ( $accountID:ID! $type:EntityType! $sortInput:[SortInput] $lookupFilterInput:[LookupFilterInput] ) {
      entityLookup ( accountID:$accountID  type:$type  sort:$sortInput  filters:$lookupFilterInput  ) {
        items  {
          entity  {
            id 
            name 
            type 
          }
          description
          helperFields
        }

        total 
      }  
    }
    Variables:
    {   
        "accountID": "12345",
        "type": "site"
    }

    Have you considered using the api explorer where you can have this application help craft these payloads for you and generate code for you as well? 
    https://github.com/catonetworks/cato-api-explorer

     

    We also have examples up on the terraform registry for how to manage networks and network rules for various route types, as well as TLSi rules for bypassing tls.  Is this what you are looking for?

    https://registry.terraform.io/providers/catonetworks/cato/latest/docs/resources/tls_rule
    https://registry.terraform.io/providers/catonetworks/cato/latest/docs/resources/wnw_rule
    https://registry.terraform.io/modules/catonetworks/bulk-tls-rules/cato/latest
    https://registry.terraform.io/modules/catonetworks/bulk-wnw-rules/cato/latest

    Please let us know if we can be of any further assistance. :D