Forum Discussion

Sean's avatar
Sean
Comet
25 days ago

Does the Cato API support batch submissions?

I'm looking to add over 200 DHCP reservations to one of our sites. Does the API support batch submissions in the following format or do I need to include the 'accountId" and 'siteId' lines for each host?

[
  {
    "accountId": "123456",
    "siteId": "78910",
    "input": {
      "name": "Host1",
      "ip": "192.168.1.10",
      "macAddress": "00:1A:2B:3C:4D:5E"
    }
  },
  {
    "input": {
      "name": "Host2",
      "ip": "192.168.1.11",
      "macAddress": "00:1A:2B:3C:4D:5F"
    }
  }
]

 

2 Replies

  • peter's avatar
    peter
    Icon for Cato Employee rankCato Employee

    Hello Sean,

    There isn't really a batch mode for addStaticHost. The best I can come up with to make it seem slightly more "batched" is to combine multiple addStaticHosts with aliases in a single mutation operation:

    However from a rate limit and logging perspective, these are still two separate API calls. I usually do automation with a Python script so I think it's more efficient and less code for me to loop around on one call, rather than try to construct a large unified single "multi-mutation" like this one. Easier to handle errors too I think.

    Regards,

    Peter

  • Hi, 
    Have you seen the guide for bulk management of static hosts via terraform from csv?  Can you do this in one command this way, and terraform will be able to manage state and incremental updates from that external data set of a csv, or even pull sources from external systems using data sources as well.

    https://registry.terraform.io/providers/catonetworks/cato/latest/docs/guides/guide_cato_static_host_from_csv

    Please let me know if you would like to set up a session to walk through this.