Forums & Knowledge base/API Integration

How to export sales and downloads

Support
posted this on April 18, 2011 17:13

To extract the sales and downloads from your script, all you have to do is making a GET HTTP request to the following Url: 

https://www.mopapp.com/api/sales/list.json

with the following parameters on the querystring:

  • account: your account name, chosen when you signed-up
  • key: your secret API key. Refer to this article to see where to retrieve it.
  • version: the version of the API function. Currently it's just 1.0
  • page (optional): since the API returns a maximus of 500 records per call, the result set is paginated, and this parameter is the number (1-based) of the page to retrieve. It's 1 by default. The totalPages parameter in the output will tell you the total number of pages you can retrieve with the specified filters.
  • dateFrom (optional): the start date of the time range to include in the result set, in one of the following formats: yyyy-MM-dd HH:mm:ss or yyyy-MM-dd
  • dateTo (optional): the end date of the time range to include in the result set, in one of the following formats: yyyy-MM-dd HH:mm:ss or yyyy-MM-dd 
  • application (optional): the application ID, as assigned by Mopapp once you register the application. To find out this ID, go to My Account => Applications and copy the value of the "Mopapp ID" column for the desired application.
  • storeAccount (optional): the store account ID, as assigned by Mopapp when you register it. To find out this ID, go to My Account => Store Accounts and copy the value of the "Mopapp ID" column for the desired account.
  • store (optional): the type of the store to filter for. Possible values:
    • 0 for Custom
    • 1 for Handango
    • 2 for MobiHand
    • 3 for RIM App World
    • 4 for Apple iTunes
    • 5 for Android Market (paid apps)
    • 6 for GetJar
    • 7 for Android Market (free apps)
    • 8 for WP7 Marketplace
    • 9 for Amazon Appstore
  • platform (optional): the type of the platform to filter for. Possible values:
    • 0 for Custom
    • 1 for BlackBerry
    • 2 for iPhone
    • 3 for Android
    • 4 for Symbian
    • 5 for Pre
    • 6 for Windows Phone
    • 7 for iPad
    • 8 for iPhone + iPad
  • appOrInAppSales (optional): to include app and/or in-app sales. Possible values:
    • 0 to include both app and in-app sales
    • 1 to include only app sales
    • 2 to include only in-app purchases
  • country (optional): the two-letter code representing the customer's country. For example US for USA, IT for Italy, DE for Germany etc.
  • currency: the three-letter code for the currency used in the sale. Possible values are USD, EUR, GBP, CAD, JPY, AUD and INR. Note that the currency is totally independent from the country: so for example an American customer might purchase in USD, but a German customer might purchase in USD too, not necessarily in EUR (it usually depends on the store settings and the customer preferences).

Sample request

https://www.mopapp.com/api/sales/list.json?account=myaccountname&key=d251e0a3a6d94e169f7b2eb374938e94&version=1.0&application=129&dateTo=2010-06-10&dateFrom=2011-01-01

Output in JSON format:

{
   "result":{
      "code":200,
      "description":"Ok"
   },
   "data":{
      "currentPage":1,
      "totalPages":3,
      "totalItems":1325,
      "items":[
         {
            "id":3963949,
            "application":67,
            "storeAccount":23,
            "store":4,
            "platform":7,
            "country":"ec",
            "version":"2.0",
            "email":"",
            "device":"iPad",
            "date":"2011-4-2 00:04:00",
            "type":0,
"inapp": 0, "numSales":1, "numUpdates":0, "numInstalls":0, "currency":"USD", "unitPrice":0.99, "unitPriceUsd":0.99, "unitPriceEur":0.70009193126367, "revenue":0.99, "profitNet":0.7, "revenueUsd":0.99, "profitUsd":0.7, "revenueEur":0.70009193126367, "profitEur":0.4950144968531 }, ...more items... ] } }

If instead of making a request to list.json you call list.xml (with the exact same parameters in the querystring) you will get the response output in XML:

<?xml version="1.0" encoding="UTF-8"?>
<root>
	<result>
		<code>200</code>
		<description><![CDATA[Ok]]></description>
	</result>
	<data>
		<currentPage>1</currentPage>
		<totalPages>3</totalPages>
		<totalItems>1325</totalItems>
		<items>   
			<item>
		    	    <id>3963949</id>
			    <application>67</application>
			    <storeAccount>23</storeAccount>
			    <store>4</store>
			    <platform>7</platform>
		    	    <country>us</country>
			    <version>2.0</version>
			    <email></email>
			    <device>iPad</device>
		    	    <date>2011-4-2 00:04:00</date>
			    <type>0</type>
<inapp>0</inapp> <numSales>1</numSales> <numUpdates>0</numUpdates> <numInstalls>0</numInstalls> <currency>USD</currency> <unitPrice>0.99</unitPrice> <unitPriceUsd>0.99</unitPriceUsd> <unitPriceEur>0.70009193126367</unitPriceEur> <revenue>0.99</revenue> <profit>0.7</profit> <revenueUsd>0.99</revenueUsd> <profitUsd>0.7</profitUsd> <revenueEur>0.70009193126367</revenueEur> <profitEur>0.4950144968531</profitEur> </item> ...more items... </items> </data> </root>

Here is what the output values mean:

  • result => code: an HTTP code that indicates if:
    • the API call was successfull (200)
    • the API call failed because the input account name or API key do not match (403)
    • the input parameters were not valid (422)
    • there was some other internal error (500)
  • result => description: the description of the API call outcome. This is especially useful in case of errors (code not 200) because it explains what went wrong.
  • data => currentPage: the number of the page of the result set returned by this call
  • data => totalPages: the total number of pages to query (relative to the filter parameters specified in the query)
  • data => totalItems: the total number of items included in the total number of pages
  • data => items: the array of items, where each one represent a sale or download record (a single record might group multiple downloads or sales though). Follows the attributes of the "item" element:
    • id: the ID of the record inserted into Mopapp's database. You'll need this value to later delete or update this record (maybe because the order was canceled or refunded)
    • application: the Mopapp ID of the application downloaded/purchased/updated
    • storeAccount: the Mopapp ID of the store account that contains the application
    • store: the ID of the store that contains the application. Possible values are described above
    • platform: the ID of the platform of the app. Possible values are described above
    • country: the two-letters ISO code of the country of the user that downloaded/purchased/updated the application
    • version: the version of the application downloaded/purchased/updated. Only available in some stores
    • email: the email of the user that downloaded/purchased/updated the application. Only available in some stores
    • device: the name of the device from which the user downloaded/purchased/updated the application. Only available in some stores
    • date: the date of the sale/download/update
    • type: the type of record. Possible values:
      • 0 if the sale is from a new customer
      • 1 if this is an update from an existing customer
      • 2 if this is a refund for a sale transaction: note that refund transactions should have been preceded by a sale transaction for the original order at some point, so that the final sums are correct (that is, the amount of the refund is subtracted from an amount that includes the value for the positive original order)
      • 3 if this is a refund for an upgrade transaction. Notes for Type=2 apply here as well
    • inapp: equals to 1 if this is an in-app purchase, 0 otherwise 
    • numSales: the number of sales/downloads, if type=0
    • numUpdates: the number of downloads, if type=1
    • numInstalls: the number of active installs, for Android apps in the Android Market (store = 7)
    • currency: the currency of the sales
    • unitPrice: the unit price of the app, in the original currency
    • unitPriceUsd: the unit price of the app, converted to USD
    • unitPriceEur: the unit price of the app, converted to EUR
    • revenue: the amount paid by the user, in the original currency
    • profit: the developer's profit (the revenue less the store's commissions), in the original currency
    • revenueUsd: the amount paid by the user, converted to USD
    • profitUsd: the developer's profit (the revenue less the store's commissions), converted to USD
    • revenueEur:the amount paid by the user, converted to EUR
    • profitEur: the developer's profit (the revenue less the store's commissions), converted to EUR
 

Comments

User photo
desmodev
Can i download the number of the total download of all my applications?.... Thank you!
May 22, 2011 18:06
User photo
Support
mopapp

No, you download the raw list of transactions/sales. Any aggregation or calculation must be done manually (i.e. with some spreadsheet app or database)

June 06, 2011 13:15
User photo
iranapp

what is my API key?please guide me to export my data.

March 29, 2012 16:13
User photo
Support
mopapp

Hi,
please refer to the following documentation article to read about the API Key:

http://support.mopapp.com/entries/206236-how-to-enable-the-api-and-where-to-retrieve-the-api-key 

March 29, 2012 16:34