Pull Request Context Parameter List?

Is there a list of Context Parameter values on pullrequest anywhere? Nothing in my searches can find anything about it… The closest I could find is this

https://developer.atlassian.com/cloud/bitbucket/context-parameters/

And it mentions,

For example a webItem on the Pull Request page could have these parameters:

  • pullrequest
  • repository
  • user
  • target_user

And indeed they appear to be in there, but where do I find what values are on them? For example how does one get the pullrequest id for example? What other values are available on that parameter? Is there some documentation for this?

@boyter It might be better to just explicitly list all of them on that page, but there are a lot!

That page does say “In fact you can deduce all the parameters from the API JSON object.” and indeed that’s the trick!

You can see an example pullrequest object here: https://api.bitbucket.org/2.0/repositories/atlassian/bbql/pullrequests

This means you can use the following for context parameters:

pullrequest.description
pullrequest.links.decline.href
pullrequest.links.approve.href
...
pullrequest.title
pullrequest. close_source_branch
pullrequest.type
pullrequest.id
pullrequest.destination.commit.hash
...
pullrequest.destination.repository.name
pullrequest.destination.repository.full_name
pullrequest.destination.repository.uuid
pullrequest.destination.branch.name
pullrequest.created_on
pullrequest.summary.raw
pullrequest.
pullrequest.source.repository.name
pullrequest.source.repository.full_name
pullrequest.source.repository.uuid
pullrequest.source.branch.name
pullrequest.comment_count
pullrequest.state
pullrequest.task_count
pullrequest.reason
pullrequest.updated_on
pullrequest.author.display_name
pullrequest.author.uuid
pullrequest.author.nickname
pullrequest.author.account_id
pullrequest.merge_commit.*
pullrequest.closed_by.*

As for what the “root” variables are that are accessible on the page, it can be assumed by where you are in the UI. If you’re on a repository page, pullrequest won’t be available and user is available everywhere as the authenticated user.

2 Likes

Cheers. Thats what I was looking for. As you say it does indicate you can deduce… but this is documentation :slight_smile: I link from the context object listings would be SOOOO useful in this case to save hunting around and wondering if you got the right one. Just makes integration so much easier.

The roots are there, just not the links to see is all.

Thanks for responding.