You already mention the API, and using the API would be the way to go. Now you only have to define what is an easy way.
I would think about the following:
- Iterate over all networks with "getNetworkWirelessSsids" to find an ID that is free for all networks. But perhaps you already know this from the previous config.
- iterate through all networks with "updateNetworkWirelessSsid" and configure the new SSID. The API-call also has an input to disable the SSID as wanted.