Overview
You need a token to perform any activities with the FogBugz API. This article provides the steps to assist you in obtaining the XML API token.
The article also explains how you can generate an XML API token for FogBugz On-Demand and FogBugz On-Site.
Process
Token Creation
- Go to the User Options page (Avatar > Options).
- Click the Create API Token button.
- Alternatively, you can also use
cmd=logon
in the XML API as described below, but only if Two-Factor Authentication is disabled for your user.
NOTE: It is strongly recommended to always authenticate using a token (that you generate in the web UI as described above), rather than authenticating using the email and password and then calling
cmd=logon
in the script itself.Implementation on FogBugz For Your Server
- Open a browser and load the following URL into it, replacing the text in [square brackets] with the values appropriate to your install:
https://[yourfogbugz]/api.asp?cmd=logon&email=[youremail]&password=[yourpassword]
NOTES:- If you are on FogBugz On-Demand, you must use HTTPS not HTTP.
- Follow the General rules for API requests, including URL Encoding your URLs.
- Otherwise, special characters in passwords may cause trouble.
- Alternatively, from the command line, set the variables
FOGBUGZ
,EMAIL
, andPASSWORD
, then run:
curl "https://$FOGBUGZ/api.asp?cmd=logon&email=$EMAIL&password=$PASSWORD"
The API should give you an XML response with a token that looks like this:
<response><token>tfhqpjantio6dav0er9lsjqpl5f2i8</token></response>
- Copy the token value. This is how you use it to do a search for
foo
:
https://[yourfogbugz]/api.asp?token=[yourtoken]&cmd=search&q=foo
- Alternatively, from the command line, set the variable
TOKEN
:
curl "https://$FOGBUGZ/api.asp?token=$TOKEN&cmd=search&q=foo"
- A token has no expiry time. However, it can be invalidated by executing a
logoff
command with that token or by changing your user’s password.