(1) It shall specify that the person in whose behalf the writ is applied for is imprisoned or restrained of his liberty and the officer or person by whom, and the place where, he is so confined or restrained, naming all the parties, if they are known, or describing them, if they are not known.
(2) If the imprisonment is alleged to be illegal, the petition shall state in what the alleged illegality consists.
(3) The petition shall be verified by the oath of the party making the application.