How to fetch a Repository from HTTP Request for user repositories (repositories that don't have projects created)

bitbucket-server
bitbucket
java
bitbucket-api
plugin-development

#1

The Atlassian API for fetching the repository using repository service is repositoryService.getBySlug(project, slug);

But, it could also be a user’s repository that does not have a project. Example

http://ubox:7990/bitbucket/users/kshi/repos/kshitijrepo/commits/643ea6502e8bd8db70f9e62d920297ea1c9e4c65
getBySlug API below fails because this repository does not have any project created for it.

public Repository getRepository(HttpServletRequest req){

        String pathInfo = req.getPathInfo();
        String[] components = pathInfo.split("/");
        return repositoryService.getBySlug(components[2], components[4]);
}

How to get the repository for users like “kshi”?

There is another API that gives the repository getById(int id). Here the id is the repository ID.
How to fetch the id using the HTTPRequest to further fetch the repository?


#2

@pvandevoorde could you help here ?