Each device has an attribute called TopologyModelNameString (0x129e7). This will display current location of the device in the Universe, like this "Universe:Container1:Container2". Last one in the enumeration is the container where the device resides.
You can get the value for each of the devices using either CLI or Restful API. Whichever suits you best. That's the fastest way to get that information. With ModelingGateway you have to wait for it to export even more information than you actually need.