Unable to update participants using civicrm api?
Since you are passing $entity_id to id in participant params without checking it to be not empty. If $entity_id is empty then new participant will be created else it will be updated. Make sure your id is set before calling to participant api if you want to update the participant

Cheers

Pradeep