code: public static long count_filtered(nitro_service service, String filter) throws Exception
  	{
  		sms_server obj = new sms_server();
  		options option = new options();
  		option.set_count(true);
  		option.set_filter(filter);
  		sms_server[] response = (sms_server[])obj.get_resources(service, option);
  		if (response != null && response.length > 0)
  			return response[0].__count;
  		return 0;
  	}
docs: Use this API to count the filtered set of sms_server resources.
  filter string should be in JSON format.eg: "vm_state:DOWN,name:[a-z]+"