Getting add-on details using JSON
The add-on resource within the
/rest/2/addons API lets you query add-on details, including every field that is visible in a Marketplace add-on listing or that can be set through Manage Listings.
For an example of a script that uses this (using the Bash shell and
get-addons.sh in the Marketplace API Tutorials repository.
You will need:
- Any tool for making HTTP requests
- The add-on key of an existing add-on
Step 1: Getting the resource URL
The URL for an add-on resource is currently
https://marketplace.atlassian.com/rest/2/addons/ADDON_KEY - substituting your add-on key for
However, rather than hard-coding the URL path for the resource, you can also obtain it by starting from the entry point of the API. This takes additional steps, but is a better practice in case resource paths ever change in the future.
— you will receive a JSON response that looks something like this:
addonsis the URL path of the resource for finding add-ons. Do a
GETrequest to this resource, with
?limit=0added to indicate that you don't actually want a full list of add-ons (
https://marketplace.atlassian.com/rest/2/addons?limit=0) — you will receive a JSON response like this:
byKey, and substitute the add-on key of your existing add-on for
/rest/2/addons/my.excellent.addon). This gives you the URL path of the add-on resource.
Step 2: Optional query parameters
You may optionally add any of the same query parameters that are supported by a query for multiple add-ons, except for
limit which are not applicable to a single add-on. The usual reason for doing this would be to get the current version of the add-on (
?withVersion=true)— or to get the latest version that meets some criteria (
Step 3: Performing the query
- HTTP method:
- URL: the add-on resource, as described above, along with any optional query parameters
- Authentication: if you want to see private data, you must provide Basic Authentication with the username and password of your Atlassian Account
Here's a sample curl request to get the details for
my.excellent.addon, along with the current version:
/_links/alternate: A web link for viewing the add-on details on the Marketplace site.
/_embedded/logo/_links/image: An image URL for the add-on's logo. Note that there is also a
/_links/logolink, which you will not normally use.
/_embedded/version: Information about the current (or latest matching) version of the add-on, if you specified
There are many other add-on and add-on version properties and resource links; for details, see the REST API documentation.