A simplfied library for Node.js 10+ for accessing Apple's App Store Connect API, written in TypeScript.
The module is quite new, so issues and pull requests are very welcome :-)
Execute the following command from your project folder, where your package.json
file is stored:
npm install --save @egodigital/appstore-connect
import * as fs from 'fs';
import { Client as AppStoreConnectClient, DownloadSalesReportFrequency } from '@egodigital/appstore-connect';
const PRIVATE_KEY = fs.readFileSync(
'/path/to/your/p8/file' // downloaded from https://appstoreconnect.apple.com/access/api
);
const CLIENT = new AppStoreConnectClient({
apiKey: '<YOUR-API-KEY>', // s. https://appstoreconnect.apple.com/access/api
issuerId: '<YOUR-ISSUER-ID>', // s. https://appstoreconnect.apple.com/access/api
privateKey: PRIVATE_KEY,
});
const SUMMARY = await CLIENT.getAppDownloads({
frequency: DownloadSalesReportFrequency.Weekly,
vendorId: '<YOUR-VENDOR-ID>', // s. https://appstoreconnect.apple.com/itc/payments_and_financial_reports
});
console.log(
SUMMARY
);
The API documentation can be found here.