Audience:
Agent and Administrator
What is it?
There are many responses to different API commands like Failed, Success, Ambiguous.
Who will use it?
Only Admin and Normal users without 2FA enabled are able to generate valid tokens using the API. Generating tokens in the UI is the recommended approach.
How is it used?
FogBugz itself supports several methods of logging on, however, the only method supported by the API is by providing an email address (or full name, just like FogBugz sign-in) and password in the logon method:
http://www.example.com/api.asp?cmd=logon&email=xxx@example.com&password=BigMac
Every response that you will receive when execute the above login URL using API token will have enough information for you to understand what it is. So that necessary action can be taken to resolve it.
Response 1:- (Failed Logon)
If you receive below opaque string as a response to the login URL that confirms its a login failed( Possible reasons email or password doesn’t match, 2FA might be turned on, etc)
<response><error code="1">Error Message To Show User</error></response>
Response 2:- (Login Successful)
If you receive below opaque string as a response to the login URL that confirms you are logged in successfully.
<response><token>24dsg34lok43un23</token></response>
Note – This token will persist until you execute a logoff command. (Token reuse is encouraged over issuing repeat logon commands.)
Response 3:-(Ambiguous logon)
If you receive below opaque string as a response to the login URL that confirms there is more than one FogBugz user with that email address.
<response>\
<error code="2">Ambiguous Logon</error>
<people>
<person>John Hancock</person>
<person>Fred Astaire</person>
</people>
</response>
Note – FogBugz will supply you with a list of full names; you must provide the appropriate full name to log on.
If, for example, you got that response, you would prompt the user with a combo box to choose if they are User1 or User2. If you are User1, you would try logging on again with this URL: http://www.example.com/api.asp?cmd=logon&email=User1&password=BigMac
You can pass the token to the logon command to find API Token validity
Logon URL:http://www.example.com/api.asp?cmd=logon&token=[your_token]
Response 4:-
If you receive below opaque string as a response to the login URL that confirms your API Token is VALID <response><token>[your_token]</token></response>
Response 5:-
If you receive below opaque string as a response to the login URL that confirms your API Token is INVALID.
<response><error code="3">Not logged in</error></response>