It seems like you're trying to retrieve the DNS name of a device from the Meraki API, but you're getting a name with spaces which is not a valid DNS name. The name field in the Meraki API and console is not guaranteed to be a valid DNS name, it's just a human-readable name for the device.
The Meraki API does not provide a separate field for the DNS name of a device. If you need to store a valid DNS name for each device, you might consider using the "notes" field to store this information. You can then retrieve it using the same API calls you're already using.
As for the `managementInterface` endpoint, it returns the configuration of the management interface for a device. The `usingStaticIp` field indicates whether the device is configured with a static IP. If this field is `false`, it means the device is using DHCP to obtain its IP configuration, including the DNS servers. The actual DNS servers being used are not exposed via the API.
If you have control over the DHCP server, you could configure it to assign a specific DNS name to each device based on its MAC address. This DNS name would then be valid and could be resolved by other devices on your network.
Please note that manipulating DNS settings and hostnames can have impacts on your network and should be done carefully. Always make sure to test changes in a controlled environment before deploying them to your production network.
I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.
Please, if this post was useful, leave your kudos and mark it as solved.