At 10:51 p.m. police received reports of several shots fired in the 3000 block of Patt Avenue, police said.
Arriving officers found a large party at a home and when they attempted to speak with someone at the residence they saw people jump a fence and flee to the back of the home, police said.
Then people in the home started throwing objects at the officers, striking one of the officers, police said.
Another person attempted to drag the officer to the rear of the home.
Another officer was injured during the incident.
The first officer was taken to a hospital and treated for injuries that were not life-threatening, while a second officer was treated at the scene, police said.
The people in the home and the back area continued to throw objects at officers and refused to cooperate. Officers retreated until additional officers were called to the home, police said.
After several hours, police -- with help from the Santa Clara County Sheriff's Office -- were able to get the partygoers to exit the house and surrender to police.
Police arrested 42 people for various charges including assault with a deadly weapon on a police officer, police said.
Many of the suspects were booked into the Santa Clara County Jail and Santa Clara County Juvenile Hall. Others were issued citations and released, according to police.
By the end of the incident, about 60 officers responded to the party.