The Swift SDK to work with the App Store Connect API from Apple.
- Automate your workflow with the App Store Connect API
- Official Apple Documentation
- WWDC 2018 Talk Automating App Store Connect
- App Store Connect API adoption with use case examples
- Configuration with API Key
- APIProvider with endpoints structure
- Add models for all endpoints
- JWT Logic to sign requests
- Get started section in the readme
- Support for Mac
- TestFlight API implementation
- Users and Roles implementation
- Sales and Finances implementation
- Replace Alamofire dependency with own simple URLSession implementation
To request access, go to the new API Keys section in Users and Access in App Store Connect. Please note that you must be the Team Agent (Legal role) of a development team enrolled as an organization. Access for developers enrolled as an individual is coming soon.
Not all endpoints are available yet, we're working hard to implement them all (see Endpoints).
import AppStoreConnect_Swift_SDK
Go to https://appstoreconnect.apple.com/access/api and create your own key. This is also the page to find your private key ID and the issuer ID.
After downloading your private key, you can open the .p8 file containing the private key in a text editor which will show like the following content:
-----BEGIN PRIVATE KEY-----
FDFDGgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwQgPaXyFvZfNydDEjxgjUCUxyGjXcQxiulEdGxoVbasV3GgCgYIKomokDj0DAQehRANCAAASffd/DU3TUWAoLmqE6hZL9A7i0DWpXtmIDCDiITRznC6K4/WjdIcuMcixy+m6O0IrffxJOablIX2VM8sHRpoiuy
-----END PRIVATE KEY-----
Copy the contents and remove the whitelines, -----BEGIN PRIVATE KEY-----
and -----END PRIVATE KEY-----
.
Use this private key together with the issuer ID and the private key ID to create your configuration file:
let configuration = APIConfiguration(issuerID: "<YOUR ISSUER ID>", privateKeyID: "<YOUR PRIVATE KEY ID>", privateKey: "<YOUR PRIVATE KEY>")
After creating an APIProvider
instance with your APIConfiguration
you can start performing your first request.
let provider: APIProvider = APIProvider(configuration: configuration)
provider.request(.apps()) { (result) in
switch result {
case .success(let appsResponse):
print("Did fetch \(appsResponse.data.count) apps")
case .failure(let error):
print("Something went wrong fetching the apps: \(error)")
}
}
AppStoreConnect-Swift-SDK will be available through CocoaPods when it's more complete. To install it now, simply add the following line to your Podfile:
pod 'AppStoreConnect-Swift-SDK', :git => 'https://github.com/AvdLee/appstoreconnect-swift-sdk.git'
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. It is in early development, but this SDK does support its use on supported platforms.
Once you have your Swift package set up, adding the SDK as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/AvdLee/appstoreconnect-swift-sdk.git", .upToNextMajor(from: "1.0.0"))
]
To help with the development of this repository you need to follow the next steps:
- clone this repository
- download the submodules dependencies
git submodule update --init --recursive
- run the fastlane called: unhide_spm_package_dev_dependencies
bundle exec fastlane unhide_spm_package_dev_dependencies
- you should be able to run the tests
bundle exec fastlane test
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
App Store Connect Swift SDK is available under the MIT license, and uses source code from open source projects. See the LICENSE file for more info.
This project is originally created by Antoine van der Lee but has a lot of great contributors. We're open for contributions of any kind to make this project even better.