The Bug Genie
star_faded.png
Please log in to subscribe to updates for this article
API Module:Usage
Last updated at Wed Feb 22 08:55, by zegenie
This API Module is still in development (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  ⇑ top

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  ⇑ top

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  ⇑ top

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  ⇑ top

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  ⇑ top

API Related  ⇑ top

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
}


Article attachments

There are no file attached to this article

Article comments (0)

There are no comments