Legacy API
https://secure.gravatar.com/avatar/b28e536690cbbcc42568497fe280b4f4.png?d=wavatar&s=28
Fri Jun 18 12:04 Authored by zegenie
This Documentation is for the legacy TBG API Module (TBG >= 4.1.6, API 1.0).
It is also not distributed in the default installation, but can be installed by checking out https://github.com/thebuggenie/module-api


The Bug Genie API Documentation  

On this documentation: Request methods are stated in the following format: PREFERRED (FALLBACK)
PREFERRED states the preferred method to be used, but any methods (or 'any') stated in braces will be accepted also.
If there are multiple formats doing different things, they will be listed in separate rows.

Example Response will always include the expected HTTP Return codes as well as the JSON representation of the usual response.

Authenticating  

Authentication requires a one-time application password. (This can be obtained in the account-overview page under "Security")
With this password send a request to the endpoint /api/authenticate/:username. After receiving the token, it has to be sent with every subsequent request using the parameter api_token.
For example:
http://issues.compa.ny/api/my_api_user/me?api_token=0123456789012345678901234567890123456789


CLI CommandEndpointParametersMethodsDescriptionExample Response
<!-- cli -->
/api/authenticate/:username
since 1.0
username: The username associated with the application password.
password: The one-time application password.
POST (any) Authenticates the requestor using the username and one-time application password and creates a token for subsequent requests.
200 OK
{
	"token": "0123456789012345678901234567890123456789"
}


Response Formats  

All API endpoints support different formatted responses. (Currently, the /authenticate/:username endpoint is the only exception.) TBG comes with default json response templates for all API endpoints, but you can make your own by adding templates with the correct response format. All endpoints therefore accept the parameter format, which by default is "json", but can be substituted with "xml" or "html" for custom responses.

You can find which template to create by looking at the module name and action name, find the corresponding "action".json.php file and add one for your custom format. No further configuration is necessary.

Errors  

Generic error messages will be in the following format, with the HTTP Status Code 500:
{
	"error": "what went wrong"
}
Endpoints may return more specific error messages, see below.

API Endpoints  

API Related  

CLI CommandEndpointParametersMethodsDescriptionExample Response
<!-- cli -->
/api/:api_username/status
none GET (any) Returns status information on The Bug Genie and the current API module.
200 OK
{
    "api_version": "1.0.0",
    "tgb_version": "4.1.6",
    "tgb_version_long": "4.1.6 (\"Abstract Apricot\")",
    "tbg_name": "My Company Bugtracker",
    "tbg_url_host": "http://issues.compa.ny",
    "tbg_url": "/",
    "tbg_logo_url": "/files/show/8",
    "tbg_icon_url": "/files/show/9",
    "online": true
}
<!-- cli -->
/api/:api_username/me
none GET (any) Returns the currently logged in user (accessing the API).
200 OK
See endpoint /api/:api_username/users/:user.
TODO: Move this code sample to that endpoint!
{
    "id": ​123,
    "name": "Oliver Kahrmann",
    "username": "founderio",
    "type": "user",
    "display_name": "Oliver Kahrmann",
    "realname": "Oliver Kahrmann",
    "buddyname": "Oliver Kahrmann",
    "email": "oliver.kahrmann@gmail.com",
    "avatar": "founderio",
    "avatar_url": "http://www.gravatar.com/avatar/14f82e0f1ed3367c682cab448142b544.png?d=wavatar&amp;s=48",
    "avatar_url_small": "http://www.gravatar.com/avatar/14f82e0f1ed3367c682cab448142b544.png?d=wavatar&amp;s=28",
    "url_homepage": "",
    "date_joined": ​1442351732,
    "last_seen": ​1454278047,
    "timezone": "sys",
    "language": "en_US",
    "state": 
    {
        "name": "Available",
        "is_absent": false,
        "is_busy": false,
        "is_in_meeting": false,
        "is_online": true,
        "is_unavalable": false
    }

}


Table Template:
CLI CommandEndpointParametersMethodsDescriptionExample Response
cli
endpoint
parameters methods description
200 OK
{
	"JSON": true
}


Attachments 0

Comments 0

/unthemed/mono/no-comments.png
Expand, collaborate and share
Post a comment and get things done