Wow, thanks! I thought this was going to work, and it has to be close. It appears that it isn’t even getting into the foreach loop. I hardcoded a value for an attachment and also just tried to get it to append the ‘constrain’ property, but no luck.
When the array comes back it looks like the attached image (this was without modifying your code at all).