This was implemented in the core some time ago; see this thread:
It returns an Arduino String class object, so myString.toCharArray will get you a C string.
Returning the ID in a variable is a little odd since you need to know that device ID in order to get variables.