The Bug Genie team blog

What's cooking behind the scenes of The Bug Genie

Access 3.1 remotely via the command line

with 7 comments

One of the absolutely awesome tools included in the 3.0 package is the cli tool. The cli tool lets you perform common tasks such as installing the system, adding and removing modules, exporting and importing articles, and more. These are all tasks operating directly on the server where The Bug Genie is installed, and are useful for your everyday server admin Joe. However, The Bug Genie – being an issue tracking tool – wouldn’t be complete without equally powerful tools for your everyday developer Jane!

In 3.1 we wanted to improve the existing tools, and give you full access to interfacing with The Bug Genie via the included cli. As many of us developer live inside a cli, being able to interface with The Bug Genie directly without having to resort to inferior tools such as a “Web Browser”, is golden! So, what do we have in store for you in 3.1?

Without further ado, let’s ask the cli tool what it can do for us:

Builtin help for the cli toolThe cli tool lists all available commands when passed the “help” parameter. Of course, this can also be used to further study the required arguments and details for the commands listed above. Let’s try this with the “list_issues” command.

CLI help for the list_issues commandAs we can see, with this command, we can query a remote server for all available issues, and even filter it on some common criteria. Supported criteria at the moment are:

  • State (open or closed)
  • Issue type (any of the available issue types)
  • Assignee (me/none/all/username)

Let’s try and list all open bug reports assigned to me:

An example of issues retrieved via the command lineNotice how the arguments passed doesn’t have to exactly match the existing values. When querying for issues of type “Bug report”, it is enough to include the word “bug” in lowercase. The Bug Genie will make an effort to try and find the type you are looking for. This is also possible for data values (resolution, status, etc) – as we will show later.

Next, we pick an issue from the list, and see what it’s all about. Let’s pick issue #389:

Using the CLI tool to show an issueWe can see basic details about the issue, here. Status, priority, etc. There seems to be very little information set on this issue. Let’s see if there are any comments:

Using the CLI tool to show an issue including commentsWe can see that the issue has been commented on. By default, when showing comments, system comments are excluded to improve readability. Fear not, we can always ask to include system comments, too!

Using the CLI tool to show an issue including all commentsAwesome! Now, seeing as this is a feature we want to implement, let’s see what we can do with it. The “remote:list_transitions” command will tell us what actions are available:

Using the CLI tool to list available issue transitionsAs we can see, we have two transitions available which will move the issue into a closed state, either “Resolve” it or “Reject” it. Let’s try and reject it:

Trying to transition an issue via the CLI (reject)Ooops. That didn’t work – apparently we can’t just reject an issue without passing more information. Can we resolve it?

Trying to transition an issue via the CLI (resolve)Waddayaknow, we can’t resolve it without more information either! How convenient – it respects the workflow defined for the project. So, what parameters would need to be passed to reject or resolve it? Again, we can use the command line tool to query The Bug Genie. The “list_transitions” command can take one of the transitions listed as a parameter to show more information about that transition. Again, we don’t have to pass “Resolve issue” as the parameter, The Bug Genie will find the correct transition:

The CLI tool showing more details for a transitionAha! We have to pass a valid resolution (“Not an issue” or “Resolved”) and a valid status (“Closed” or “Postponed”). We pass this information to the “Resolve issue” transition and try again:

Successfully transitioned to an issue via the CLI (resolved)Now that’s what we want to see! So, how does the issue view look after the transition was successfully applied? We use the cli to retrieve the issue again:

Issue listing after the issue has been transitionedSuccess!

The cool thing about all this is that to achieve the functionality above, The Bug Genie 3.1 had to learn a new language: JSON. To be honest, it already did speak some JSON, but for this task it needed to speak JSON much better. We added JSON responses for the issue view, and the update issue action now speaks JSON as well. The same is also true for the issue listing, as you can see above. In addition, there are a some new views available, such as project listings, transition listings and datatype listings. Because these are all implemented with JSON, using these endpoints for your own applications is easier than ever.

If this didn’t make you want to install The Bug Genie 3.1 when it’s out, I’m all out of teasers. No, wait, I can probably find another one. Let’s try again tomorrow.

Written by Daniel André

March 28, 2011 at 08:56

Posted in The Bug Genie 3.1

Tagged with , ,

7 Responses

Subscribe to comments with RSS.

  1. Is there somewhere a documentation on the JSON API (or any other available API) available? I had a request from a customer to integrate TBG with MS Project and would gladly do this for him.

    Christian

    May 30, 2011 at 12:46

  2. Unfortunately not yet, but it’s something we would be glad to create. If you send me an email I can help you with the details.

    zegenie

    May 30, 2011 at 13:39

    • Thank you – right now I’m in the process of evaluating possible integration scenarios and so just need an overview about which API is available and the general possibilities you have with it (creating issues, getting information like time spent e.g. from TBG).
      As soon as I have some more details I will contact you. Until then – thanks for a great and promising product

      Christian

      May 31, 2011 at 16:07

  3. After successfully installing and using this product for a customer, I’m again back to the question of integrating thebuggenie with another existing tool.
    Are there any news on the JSON API documentation? If not, I would be extremely thankful for some hints in the right direction, possible commands etc.
    Thanks and looking forward to hearing from you.

    Christian

    February 11, 2013 at 11:42

    • There is an API documentation in the user guide in the wiki, have you tried it?

      zegenie

      April 1, 2013 at 07:50

      • Yes, I found the API page in the wiki and additionally a good forum post on the topic. Nevertheless I’m not completely done with this, the procedure is not working as purely JSON, I currently use a combination of form posts and json to reach my goal. E.g. the json requests to generate a new issue don’t return values of custom fields in the issues. I will spend some more time on this I think and then do a post in the forum detailing my findings.

        Christian

        April 4, 2013 at 10:05

      • Great. Just let me know if you have any suggestions on improvements that could make it easier. Extending and expanding the json api in 3.3 is no problem.

        zegenie

        April 4, 2013 at 10:48


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: