Icinga REST API and custom variables

I’m currently working for a customer who wants review its Nagios configuration. Our goal is to create a script to schedule a downtime for all servers which have a custom variable. So, the first step is to find the list of this server! After digging into the REST’S API source code, here the snippet: