Basically, Lotus sued Borland because the menu layout of Quatro was identical to 1-2-3. They won initially, but ultimately lost in the Supreme Court. The judgement was that the mechanism for using a program was not a copyrightable form. Prior to this case, I guess everyone sane had assumed that an API was a basically equivalent mechanism (just one for a programmer instead of a user). But Oracle has the constitutional right to sue for what they believe they own, so there's no "short circuit" that would prevent the suit.
The only reason this hasn't happened is because most companies are not that "evil" to actually try to use vague patents against other companies, and they just want to own them for defensive purposes (which wasn't the goal of patents at all). But this shows just how screwed up the law is, and that if all companies would want to collect their "rights" the system would collapse. Instead, right now there are only a few who do it, and it's very profitable for them because nobody is really challenging them on this.
Now one could say that there are many patents that should have never been granted to MS or others (one of the better examples for MS would certainly be getting a patent on a Windows sudo implementation - US6775781) - but it might be indicative why MS went along the path to get patents on APIs vs trying to just copyright it.
Given that copyright protects the form of expression rather than the subject matter itself this pretty much explains why the copyright office would only require the first and last 50 lines of code.
While the answer with e.g. REST APIs that are pretty much exchangeable might be rather easy with more complex ones like system level or also the Java API this becomes pretty complex.
Maybe an analogy might help: If you take a car you might be able to patent and copyright most parts and functions but you certainly will not be able to copyright that you can drive the car per-se.
With an API like the Java API where the majority has been open sourced the actual use of the API (IMHO up to the wording of it or making this wording available in your application) is merely the general ability to use the solution overall - like diving a car or making it possible to drive along with other cars in traffic.
Then comes the question if Sun / Oracle have actually previously provided the permission to use the API directly or as part of other licenses (e.g. ClassPath)