That answers the reading part of the question. As far as setting the ID of each MAV the closest I could find would be to send a COMMAND_LONG message using MAV_CMD 221 (MAV_CMD_DO_GUIDED_MASTER).
Can anyone confirm whether thats the intention of this command?
A bit further digging and I have found the parameter “SYSID_THISMAV” which can also be used to read and write the SYS ID of the aircraft using PARAM_REQUEST_READ (#20) and PARAM_SET (#23).
The only problem with PARAM_SET is it’s only temporary. The MAVLink documentation says to use ACTION MAV_ACTION_STORAGE_WRITE to PERMANENTLY write the RAM contents to EEPROM. However I can’t find the information in the documentation for this storage write command?