[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 |
|
Datasource Test URL |
|
Datasource User | User permitted to access the vendor account |
Datasource Password | Password of the account |
Query
Query URL |
|
---|---|
Example parameters |
|
Raw result |
CODE
|
Converter Examples
The simplest converter would just return the transactions
array.
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:
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.
<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: