Wiki

Case Status
Register Log In

Wiki

 
Command Line Client - DEPRECAT…
  • RSS Feed

Last modified on 2/24/2012 10:14 AM by User.

Tags:

Command Line Client - DEPRECATED

NOTE: The FogBugz Command Line Client is no longer supported. It still may continue to work, but it is officially a deprecated product. The FogBugz XML API with its Python wrapper is the preferred method for scripting in FogBugz. There's also a reasonable Ruby wrapper for FogBugz.

Download the FogBugz Command Line Client:

Philosophy

The CLI is stateless across invocations. Consider it to be like the MySQL command line interface: you pass a username, password, FB URL, and a command (or pipe in a whole list of commands), and it executes it all in one go, printing the output. If you don't specify a command, you will enter an interactive command line interface—again just like MySQL—that gives you a place to execute a number of commands in series.

NOTE: The command line client does not allow you to create cases.  It only allows you to read cases.

Some Example Uses

List all the cases in the current filter, using the --extended option to force a name-value field list. Empty or irrelevant fields are excluded unless --all-fields is passed. Cases in a list are separated by 80 asterisks.

$ fbcli --url ducks.fogbugz.com --user "johnsmith@ducks.net" --extended list
Password:
Case: 123
Title: Duck, Duck... but No Goose!
Open: Yes
Status: Geschlossen (Fixed)
Category: Feature
Project: The Farm
Area: Pond
Assigned To: Old MacDonald
Priority: 3 - Must Fix
Fix For: Test
Date Due: 2007-05-06T22:22:37:31Z
********************************************************************************
Case: 124
Title: Ring Around the Rosie
Open: Yes
Status: Geschlossen (Fixed)
Category: Bug
Project: The Farm
Area: Pond
Assigned To: Old MacDonald
Priority: 3 - Must Fix
Fix For: Test

Pipe in a list of commands. Suppose the file contained the commands "list" and "resolve 394". The output between commands is separated by 80 = signs; just as before, the cases in a list are separated by 80 asterisks. Note that the resolve command prints out the bug just resolved with its new status.

$ fbcli --url ducks.fogbugz.com --user "johnsmith@ducks.net" --extended < commands.fb
Password:
Case: 394
Title: Duck Feeding Farm
Open: Yes
Status: Active
... ommitted for brevity ...
Fix For: Test
********************************************************************************
Case: 310
Title: Ducks
Open: Yes
Status: Resolved (Fixed)
... ommitted for brevity ...
Fix For: Test
================================================================================
Case: 394
Title: Duck Feeding Farm
Open: Yes
Status: Resolved (Fixed)
... ommitted for brevity ...
Fix For: Test

An interactive session, this time not using the --extended option. Note that you can resolve a case with the numeric ixStatus or the name of the status, which is matched to a close status name ("Won't Respond" -> "Resolved (Won't Respond)").

$ fbcli --url ducks.fogbugz.com --user "johnsmith@ducks.net"
Password:
Type "help" for help.
fbcli> list
1203 To Do: Create this
393 Feed the Ducks
3032 Some other issues
3204 A quick question
fbcli> view 393
393: Feed the Ducks
Schedule Item in The Farm (Misc)
Active, Assigned to Joe Daniels
Fix For Test

Opened by John Smith, 12/18/2007 (Today) 3:45 PM
Estimate set to '5 hours'
Remember to feed the ducks.

Edited by John Smith, 12/18/2007 (Today) 3:55 PM
Project set to "The Farm"
Area set to "Misc"
Editing the project and area, whoops...

Assigned to Joe Daniels by John Smith, 12/18/2007 (Today) 4:15 PM
Joe, can you look into this?
fbcli> statuses
Active
Resolved (Responded)
Resolved (Won't Respond)
Resolved (Spam)
Resolved (Not Reproducible)
Resolved (Completed)
fbcli> resolve 393 Active
Error: invalid resolution...
fbcli> resolve 393 Completed "Took care of it myself"
... omitted for brevity ...
fbcli> resolve 3032 "Resolved (Canceled)" "Don't need to do this"
... omitted for brevity ...
fbcli> quit

Command Line Parameters

The following parameters are allowed. On Windows, we expect "/" in place of "--" for indicating command-line switches—for example, /user or /password.

  • --user <username>
    The user name or email.
  • --password <password>
    Directly specifies the password on the command line. This option is insecure; preferably, the --password-file option should be specified or both --password and --password-file should be ommitted (which results in the password being requested securely).
  • --password-file <path>
    For programmatic use; a path to a file with the user's unencrypted password. This is more secure than specifying the password right on the command line (since it would then show up in PS, bash history, etc.) and more convenient than jumping through hoops to pass things to secure input programmatically.
  • --url <url>
    The URL of the FogBugz installation. You can force a SSL connection by including "https://" before the URL.
  • --extended
    Force a longer output, displaying a colon-delimited name-value pair for every field in each bug.
  • --all-fields
    Return all fields for requests, not just those that are relevant and non-empty. For example, "Customer Email", "Resolved By", and "Computer" are only sometimes relevant and actually set, but this flag forces them to be displayed anyway. This option only applies if --extended is enabled; if it is not, we will halt with an error.
  • --numeric
    Returns numeric values for fields instead of the string values. For example, "Assigned To" would return "3" (ixPersonAssignedTo) instead of "Old MacDonald" (sPersonAssignedTo).
  • --xml
    Just return the raw XML resulting from the command. Useful if the CLI is being used programmatically instead of by a human. This option is incompatible with --extended, --all-fields and --numeric; if the user specifies any of those and this option, we will halt with an error. If we are in batch mode (where multiple commands are piped in), XML payloads are conglomerated into one XML document output. The root node of this document is <results>, which has children of the form e.g., <result command="list">. Each of the <result> nodes has a CDATA child with the XML output of that command.

Commands

  • list
    Lists all of the cases in the current filter.
  • setfilter <sFilter/Filter Name>
    Sets the user's current filter. The parameter can be the opaque "sFilter" field (from listing the filters using the filters command) or the string name of the filter (e.g., "My Cases").
  • view <ixBug>
    View a case, identified by its case number.
  • edit <ixBug> <sEvent> [<fieldname = value> <fieldname = value> ...]
    Edit a case. An example (note the spaces between the fieldname and value):

    edit 394 "An interesting idea, worth considering!" Project = 2 Area = "Misc (Other)" Title = "Duck Feeding Farm"

    Field names are not case-sensitive. Values are validated for the type expected before actually sending an API request. A complete list of the fields that can be edited from the commandline client:
    • Title
    • Project (use a numeric ixProject or string sProject)
    • Area (use a numeric ixArea or string sArea)
    • FixFor (use a numeric ixFixFor or string sFixFor)
    • Category (use a numeric ixCategory or string sCategory)
    • Priority (use a numeric ixPriority or string sPriority)
    • Date Due (use mm/dd/yyyy or Zulu time: yyyy-mm-ddThh:mm:ssZ)
    • Version
    • Computer
  • assign <ixBug> <ixPerson/sPerson> [<sEvent>]
    Reassign a case. Person can be identified by a person's numerical index or name (ixPerson or sPerson), with the difference automatically detected. Optionally, a string message can be included (to be passed to sEvent).
  • resolve <ixBug> <ixStatus> [<sEvent>]
    Resolve a case. The resolution can be identified by numerical index or name. Optionally, a string message can be included.
  • close <ixBug> [<sEvent>]
    Close a case.
  • reactivate <ixBug> [<sEvent>]
    Reactivate a case.
  • reopen <ixBug> <ixPerson/sPerson> [<sEvent>]
    Reopen a case and assign it to the specified person.
  • filters
    List all filters.
  • statuses
    List all statuses.
  • projects
    List all projects.
  • areas
    List all areas.
  • categories
    List all categories.
  • priorities
    List all priorities.
  • people
    List all people.
  • fixfors
    List all fixfors.
  • mailboxes
    List all mailboxes.

Security

Since the token isn't reused across invocations (in v1), the command line interface will always log off when exiting for the sake of security.