Get deployments using the API

I’m trying to interrogate the devices to see which deployments they have received. I can iterate through all the devices but can’t seem to get it to list it’s deployments. Is it even possible?

John