In ultimately excised dialogue from the final revised draft script of TOS: "The Conscience of the King", Kirk was referred to as having been a midshipman even shortly after leaving the Academy. One of the scripted references to Kirk having been a midshipman was even included in a deleted scene from "The Conscience of the King", which referred to him as having held the rank at the time of a massacre on Tarsus IV. ("Swept Up: Snippets from the Cutting Room Floor", Star Trek: The Original Series - The Roddenberry Vault special features)
Several non-canon reference manuals, such as Star Trek: The Next Generation Officer's Manual, have attempted to explain the difference between midshipman and cadet with the common reasoning being that cadet is the standard training rank at Starfleet Academy with midshipman a rank held during advanced leadership studies or in a fifth year status. Regardless of the difference, later Star Trek series have never mentioned the rank of midshipman.
The existence of a further "Officer Candidate" rank, senior to midshipman, has been mentioned in a handful of Pocket Books publications, most often as a way to explain prior civilian doctors and scientists who join Starfleet as officers without having attended Starfleet Academy. (citation needed • edit) The rank of Officer Candidate, however, has never been mentioned in a live action Star Trek production.