Using EntityLinks to query Jira data from a BitBucket plugin


I’m working on creating a BitBucket plugin to enforce a naming scheme for branches which I realise is not really how git is meant to work but it’s a requirement from a team at my company. As part of it, I’m writing a class to validate any Jira ID’s that are in the branch names.

To do this I’m trying to use EntityLinks since I know Jira and BitBucket are connected via an ApplicationLink. I’ve tried looking at different questions and examples that use EntityLinks but so far haven’t had any luck returning any data.

Is EntityLinks the right way to do this? Or is there another way of querying Jira data from a BitBucket plugin?

BitBucket 5.3.2
Jira 7.4.4
Atlassian SDK 6.3.4

Almost. You’ll want to use the ApplicationLinkService:

Then in it get the appropriate ApplicationLink (in your case I’m guessing that it’s going to be all of the Jira instances - so look at ).

One the ApplicationLink you’d call - that will then allow you to create authenticated requests to wherever the instance is.

One note though: Since you’re running on every git interaction - you’ll be very chatty - so make sure to cache the look ups: .

All of that said (Warning promo pitch ahead) - you could look into Wittified’s Javascript Hooks for Bitbucket Server since you can write some javascript code that interacts with Jira from Bitbucket Server (Note: I’m one of folks behind this app): (Promo pitch over).

1 Like

Thank you for replying, really helpful!

I’ve been trying out the steps you provided but I’m now running into compilation issues when trying to use Response and Request from the package. I was going to start a new topic on it as it might be a completely separate topic.

I’ll keep an eye out for the post either way :slight_smile: