Skip to main content
Flexible Top Header
Solved

v2 API: GET Associated Deployment Roles for servers

  • July 16, 2025
  • 4 replies
  • 63 views

Forum|alt.badge.img+2

I’m trying to find a way to retrieve the Associated Deployment Role Objects for servers, including the object info that I’m able to see in the GUI (zones, etc). I’m able to use this below to get the roles, but that embedded data doesn’t include the zone/network, and using the returned ID to get the object doesn’t contain that data either. Is there another way? 

{{bam_url}}/api/v2/servers/:id?fields=embed(deploymentRoles)

Best answer by tmaestas

Actually, if you do it your way by fetching /api/v2/servers/<id> and embed(deploymentRoles) the embedded role’s _link.up.href will have the zone object to which the deploymentRole is assigned (at least for the DNS deployment role).  You can’t embed _links.up but you could separately fetch that object.  Oddly /api/v2/servers/<id>/deploymentRoles does not return the link to the zone, but /api/v2/servers/<id>?fields=embed(deploymentRoles) does.  There must be some subtle distinction that causes this but I don’t really know why...

4 replies

Forum|alt.badge.img+2
  • Verified Resolver
  • July 16, 2025

Not sure how to do this in 9.x.  I checked how the beta 25.1/Integrity X GUI was doing it and it uses (amongst other fields)

/api/v2/servers/<id>/deploymentRoles?fields=_embedded._assignedTo.absoluteName

..but this doesn’t work in 9.5.2 (not sure about 9.6)


Forum|alt.badge.img+2
  • Author
  • Network VIP Newbie
  • July 16, 2025

Thank you - good to know about the future version! 


Forum|alt.badge.img+2
  • Verified Resolver
  • Answer
  • July 16, 2025

Actually, if you do it your way by fetching /api/v2/servers/<id> and embed(deploymentRoles) the embedded role’s _link.up.href will have the zone object to which the deploymentRole is assigned (at least for the DNS deployment role).  You can’t embed _links.up but you could separately fetch that object.  Oddly /api/v2/servers/<id>/deploymentRoles does not return the link to the zone, but /api/v2/servers/<id>?fields=embed(deploymentRoles) does.  There must be some subtle distinction that causes this but I don’t really know why...


Forum|alt.badge.img+2
  • Author
  • Network VIP Newbie
  • July 17, 2025

Wow thank you! That should get me what I need! 🙌🏻