i cannot seem to figure out how to bulk delete using the api

below is some code I’ve been trying. I also tried leaving off the ‘deleted’ in the params array and used this:

                //      $list[]=array(array('name'=>'ids','value'=>$row['meeting_id']),array('name'=>'deleted','value'=>'1'));  in the foreach.

   foreach($meetings as $row){

                        $list[]=array(array('name'=>'ids','value'=>$row['meeting_id']));
                }


                $params=array(
                        'session' => $GLOBALS['session_id'],
                        'module_name' => 'Meetings',
                       'deleted'=>'1'
                        'name_value_lists' =>
                                $list

                );

Ah, figured it out. Time away from the screen always helps.
It seems that ‘name_value_lists’ is NOT the thing to try, I was confused by this in the documentation.
Here’s the working code:

                foreach($meetings as $row){
                        $list[]=array(array('name'=>'id','value'=>$row['meeting_id']),array('name'=>'deleted','value'=>'1'));
                }
                $params=array(
                        'session' => $GLOBALS['session_id'],
                        'module_name' => 'Meetings',
                        'name_value_list' => 
                                $list
                );
                $result=call("set_entries", $params, $GLOBALS['url']);

the foreach builds an array (of arrays) of meeting entries to delete, thus using just a single “set_entries” call.

Hi @mediaphyte

thanks for sharing your solution.

Next time don’t forget to wrap your code in the Forum’s “code” tags, otherwise some brackets are lost.

Thanks :slight_smile: