Make API and CLI generate similar domains

As per #1486, it is possible to create a domain that consists of lowercase
alphanumeric characters. Make the API match the CLI's behaviour in this regard.
Merge pull request #1487 from Ichimonji10/domain-entity

Make API and CLI generate similar domains