Skip to end of metadata
Go to start of metadata

This page tells you how to add your gadget to an Atlassian application (JIRA, Confluence, etc) as a plugin.

In short: Add a <gadget> module type to your atlassian-plugin.xml file.

On this page:

Standalone Gadget or Plugin?

How feasible is it to create an Atlassian gadget that consists purely of HTML, CSS and Javascript? Assuming that the Confluence or JIRA (or whatever) REST API could do everything that the gadget needs, can you bypass the plugin side of things altogether?

You can choose to write a standalone gadget or a gadget embedded in a plugin.

  • A standalone gadget consists entirely of HTML, CSS and Javascript, all contained within the gadget XML file. To retrieve data from an application, you can use a REST API, for example.
  • Alternatively you can write a gadget and a plugin, and embed the gadget into the plugin XML using the gadget plugin module. The plugin needs to be installed into the Atlassian application, such as JIRA or Confluence.

Limitations if you do not embed your gadget in a plugin:

  • You will not be able to use #-directives. This means that, if your gadget is requesting data from an Atlassian application, the gadget can only access a single, specific instance of that application because you will need to hard-code the base URL.
  • It is significantly more difficult to use the Atlassian Gadget JavaScript Framework, because you will need to code everything that is normally automatically generated by the #supportedLocales and #includeResources directives.

That said, there are two main reasons why you may be interested in writing standalone gadgets:

  • It is a much simpler way to write very basic gadgets. This provides an easier way to learn how to write gadgets.
  • A non-plugin gadget may be sufficient if your gadget is for your own company's internal use with a single Atlassian application/site.
  • You may want to write gadgets that request data from some non-Atlassian system or web service, in order to integrate that data into an Atlassian application such as JIRA or Confluence.

Embedding your Gadget into a Plugin

The rest of this page describes the gadget module type that you will use to embed your gadget within an Atlassian plugin.

Prerequisites

Purpose of the Gadget Module Type

Gadget plugin modules enable you to add your gadget to an Atlassian application (JIRA, Confluence, etc) as a plugin. Your gadget can then make use of the application's remote API to fetch data and interact with the application.

Configuration

The element for the Gadget plugin module is gadget. It allows the following attributes for configuration:

Attributes

Name

Required

Description

Default

key

(tick)

The key attribute is a standard module key, so it is required and must be unique within the plugin across all module types. Atlassian Gadgets does not use this key for anything special, so you can choose any key you like.

 

location

(tick)

The location attribute can be either the relative path to a resource within the plugin, or the absolute URL of an externally-hosted gadget.

 

Example

The syntax of the module type is:

URL for Published Gadgets

Gadgets published by an Atlassian container (such as JIRA or Confluence) are provided by the REST plugin module built into the Atlassian Gadgets framework. The URL of published gadgets has the following format — with context:

Or without context:

Example:

RELATED TOPICS

Creating your Gadget XML Specification
Writing an Atlassian Gadget
Basics of Exposing REST APIs via Plugins
REST Plugin Module

  • No labels