Skip to main content
Skip table of contents

[Internal] Atlassian Marketplace API - Sales Reporting

This query fetches sales information for a specific vendor and a specific plugin.

We at Lively Apps use a query like this to provide an overview about our current Atlassian Marketplace sales for all of our co-workers - without depending on whether they have direct access to our Marketplace account or not.

Datasource

Datasource type

REST Basic

Datasource URL

https://marketplace.atlassian.com/rest/2/vendors/<vendorId>/

Datasource Test URL

sales

Datasource User

User permitted to access the vendor account

Datasource Password

Password of the account

 Query

Query URL

reporting/sales/transactions?addon=:AppKey&limit=50

Example parameters

  • AppKey: de.scandio.confluence.plugins.pocketquery

Raw result

CODE
{
    "_links": {
      ...
    },
    "transactions": [
        {
            "transactionId": "AT-1111111111",
            "addonLicenseId": "2222222222",
            "licenseId": "SEN-333333333",
            "addonKey": "de.scandio.confluence.plugins.pocketquery",
            "addonName": "PocketQuery - SQL & REST for Confluence",
            "lastUpdated": "...",
            "customerDetails": {
                "company": "Company Example",
                "country": "Sweden",
                "region": "EMEA",
                "technicalContact": {
                    "email": "admin@example.company",
                    "name": "Jim Morrison"
                },
                "billingContact": {
                    "email": "billing@example.company",
                    "name": "Jimmy Page"
                }
            },
            ...
    ]
}

Converter Examples

The simplest converter would just return the transactions array.

JS
function convert(json) {
	return JSON.parse(json).transactions;
}

However, this will just return all the data, including the nested objects. These will just display as [object Object] - not very useful. A better converter will look like this:

JS
function convert(json) {
	var transactions = JSON.parse(json).transactions;
	return transactions.map(function(transaction) {
		return {
			'ID': transaction.transactionId,
			'Date': transaction.purchaseDetails.saleDate,
			'Organisation Name': transaction.customerDetails.company,
			'TechnicalContactName': transaction.customerDetails.technicalContact.name,
			'TechnicalContactMail': transaction.customerDetails.technicalContact.email,
			'Tier': transaction.purchaseDetails.tier,
			'Purchase Price': '$' + transaction.purchaseDetails.purchasePrice
		};
	});
}

The output will look something like this:

Template Example

Let’s assume we want to create email links for the TechnicalContactMail column. We can do so by changing the default template slightly. In this example, we’re using the implicit $velocityCount variable to check for the index of our TechnicalContactEmail column.

CODE
<table class="aui confluenceTable pocketquery-table">
    <thead>
    <tr>
        #foreach ($column in $columns)
            <th class="confluenceTh">$!column</th>
        #end
    </tr>
    </thead>

    <tbody>
        #foreach ($row in $result)
        <tr>
            #foreach ($column in $row)
                #if ($velocityCount == 5)
                    <td class="confluenceTd">
                        <a href="mailto:$!column">
                            $!column
                        </a>
                    </td>
                #else
                    <td class="confluenceTd">$!column</td>
                #end
            #end
        </tr>
        #end
    </tbody>
</table>

The emails in our result will now be links:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.