What is the AppAnnie API route for IAP data via a Python script?

0
0
Marked as spam
Posted by unknown (Questions: 2, Answers: 1)
Asked on September 24, 2019 10:36 pm
6 views
0
Private answer

After re-reading the documentation, I can answer the question myself and want to share it here. Maybe someone else is searching for the same solution :)

For the IAP data you want to read this article carefully: https://support.appannie.com/hc/en-us/articles/360010475333-5-Product-Sales (my answer was in the section with the "break_down" parameter ;)

If you only have one app in AppAnnie, then this should get you going to connect to the AppAnnie API and get your IAP data. It is maybe not the best solution, but worked for me.

Python Code:

 

import json
import requests
import pprint

#your AppAnnie API access token. You will get this in your AppAnnie settings
key = "bearer xxxxx"

#use this route to get an overview of your IAPs, containing 1. IAP name, 2. SKUs (the unique IAP identifier), 3. the IAP type 

url = "https://api.appannie.com/v1.3/accounts/{Your-AppAnnie-Account-ID}/products/{Your-AppAnnie-Product-ID}/iaps"
response = requests.get(url, headers={"Authorization": key})
data = response.json()
pprint.pprint(data)

#now we need the actual sales data (how many IAPs were sold on a given day per geo?)
#here is the part that I oversaw --> break_down= ...+iap

url = "https://api.appannie.com/v1.3/accounts/{Your-AppAnnie-Account-ID}/products/{Your-AppAnnie-Product-ID}/sales?break_down=date+country+iap&start_date=2019-09-01&end_date=2019-09-01"
response = requests.get(url, headers={"Authorization": key})
data_sales = response.json()
pprint.pprint(data_sales)

 

That´s basically it. You will now have 2 exports:

  • one with basic IAP infos such as: iap_name, sku and iap_type
  • the second with actual sales data for each IAP with a break-down per country, date and iap

Since the second export only provides you with the SKU IDs you will have to map export one to export two on that unique identifier to provide you with the clear names of your IAPs (if needed). You can use the Pandas library for that, which is an excellent solution to merge data (inner join, outer join, etc)

Hope that helped someone :)

BR

Sven

Marked as spam
Posted by Sven_Juergens (Questions: 2, Answers: 1)
Answered on October 4, 2019 1:21 pm