I've had no problems getting last build details out of Jenkins in the past, but I've struck a weirdly-configured corporate environment, where the API urls are structured like this:
https://example.com/job/group-name/job/project-name/api/json
I can find the last build for a specific branch in this heirarchy:
https://example.com/job/group-name/job/project-name/job/branch-name/lastBuild/api/json
But how to get the last build of a project regardless of branch has defied all my efforts so far.
I can tell you that the obvious (and all non-obvious variations that I've tried) truly, seriously don't work. For instance, this is a complete failure:
https://example.com/job/group-name/job/project-name/lastBuild/api/json
And returns "This page isn’t working example.com redirected you too many times."
I'm guessing that the multiple copies of /job/ in the working URLs are a symptom of an unusual structure, so if anyone has any ideas I'm all ears!