No, you cannot diagnose hernia by endoscopy, you need to get an ultrasound abdomen.
Next Steps
If you suspect you have a hernia, please consult a general surgeon and get an ultrasound abdomen done.
Health Tips
Usually hernia will not cause much trouble, but it may get strangulated or twisted or obstructed, in which case you might get severe pain and vomiting.