• Welcome to The Network People Support Forums. Please login or sign up.

more q's for NicToolServerAPI

Started by shaun, March 31, 2005, 10:58:06 AM

Previous topic - Next topic

shaun

I currently have this code...


  my $nt_group_zones = $nt->send_request(
     action => "get_group_zones",
     nt_user_session => $nt_user->{'nt_user_session'},
     nt_group_id => $nt_user->{'nt_group_id'},
     limit => "10",
    quick_search => '1',
    search_value => $zone,
     );
  if($nt_group_zones->{'zones'}->[0]->{'nt_zone_id'}) {
     my $nt_zone = $nt->send_request(
        action => 'get_zone',
        nt_user_session => $nt_user->{'nt_user_session'},
        nt_zone_id => $nt_group_zones->{'zones'}->[0]->{'nt_zone_id'},
        nt_group_id => $nt_user->{'nt_group_id'},
     );
     unless( $nt_zone->{'zone'} eq $zone ) {
        print STDERR "Search Returned Zone: ".$nt_zone->{'name'}." but i was looking for ".$zone.", BUG!\n";
        return;
     }
  }



I'm basically searching for a zone so i can get it's nt_zone_id.  The problem with quick search that i just found was that it is not doing a exact match.  In the API documentation i dont see that option for quicksearch so i'm assuming i have to use the normal search.  My problem is i dont understand how to use it.  the N_ is confusing me, i'm sure it's simple and i'm just over looking it.  Can somebody provide me a example of using the API search func to get the exact match of a zone so i can get it's id.


Thanks

shaun

Never mind, figured it out my self, just added exact_match => '1' to my quicksearch..

boy what adding print Dumper($q) will show you when you put it in the main() sub of the nictool client Smile