Pass Repository Id or ProjectKey + RepoSlug?

Hi there,

I’m currently in the early stages of working on a small BitBucket plugin which will be used to locally clone a specified repo branch (I’m using JGit) and then pass the fresh clone on to a third party JAR (via a command-line call) which will scan through the cloned project and do some stuff (not currently at liberty to divulge!) and then remove the local clone.

So I have a custom Servlet which is tied to a web-item in the ‘bitbucket.web.repository.header.buttons’ section and which calls my servlet via a link. The servlet then renders a soy template (lists the branches and ‘scanning’ options etc). The ‘scan’ itself will have to be implemented as an async job but I’m not there yet.

My current question is simple. I can send the servlet either $repository.id or both $repository.slug and $repository.project.key (via the URL) in order to load the Repo. Both work, but is there a prefered method?

Cheers!

Hi @a.webster,

Whilst I’m familiar with the API, I believe it would be better to use repository.id on the assumption that the repository.id is immutable whilst repository.project.key and repository.slug could be mutable.

Regards,
Dugald

1 Like