Adding device groups to MDM using automation?

Adding device groups to MDM using automation?

I know there is a REST API, but is there any way to import a list of device groups, or is REST the only way to do something like this?

I'm beginning a large project which will require a large list of new device groups, and would like a automated way to do it.

Also, is there a limit to how many groups I can have?

Thanks in advance,
Mark