Skip to content

Instantly share code, notes, and snippets.

@ayakix
Last active December 24, 2020 05:23
Show Gist options
  • Save ayakix/cd14ffebdc6d93805d5995d3459b4f69 to your computer and use it in GitHub Desktop.
Save ayakix/cd14ffebdc6d93805d5995d3459b4f69 to your computer and use it in GitHub Desktop.
AppStoreConnect API

APIの作成

  1. [ユーザとアクセス]を開く
  2. [キー]画面を開く
  3. +ボタンよりキーを生成し、p8ファイルをダウンロードする

https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api

JSON Web Token (JWT)の作成

  1. Key Id(Headerに必要)とIssure Id(Payloadに必要)を取得する
  2. p8, Key Id, Issure IdよりTokenを生成する

Rubyの場合はGenerating JWT Tokens for App Store Connect APIを参考にする

https://developer.apple.com/documentation/appstoreconnectapi/generating_tokens_for_api_requests

通信確認

curl -v -H 'Authorization: Bearer [signed token]' "https://api.appstoreconnect.apple.com/v1/apps"

Salesレポートのダウンロード

Vendor Numberを取得する

https://reportingitc2.apple.com/reports.html から指定する すべてのベンダー をタップする

curl -v -H 'Authorization: Bearer YOUR_TOKEN' --globoff "https://api.appstoreconnect.apple.com/v1/salesReports?filter[reportType]=SALES&filter[reportSubType]=SUMMARY&filter[frequency]=DAILY&filter[reportDate]=2018-11-01&filter[vendorNumber]=YOUR_VENDOR_NUMBER" > output.gz

gunzip -d output.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment