Skip to content

Commit 08d26a4

Browse files
author
Sia Ghassemi
committed
added first implementation
1 parent 6f6afd3 commit 08d26a4

File tree

192 files changed

+8341
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+8341
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ bld/
3030
[Oo]bj/
3131
[Ll]og/
3232
[Ll]ogs/
33+
Key/
3334

3435
# Visual Studio 2015/2017 cache/options directory
3536
.vs/

README.md

Lines changed: 318 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,318 @@
1-
# AppStoreConnect
1+
# AppStoreConnect
2+
3+
This is a dotnet library and cli for interaction with Apples App Store Connect API.
4+
5+
## Install
6+
This app is available as a [dotnet tool](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-install) and as a self contained executeable for Windows and MacOS
7+
8+
### dotnet tool
9+
To install this app as a dotnet tool run from command line
10+
```bash
11+
dotnet tool install SiaConsulting.AppStoreConnect.Cli -g
12+
```
13+
### self contained
14+
[Win x64]()
15+
16+
[MacOS]()
17+
18+
## Usage
19+
20+
### Help
21+
if you just run the command you will get the help:
22+
```bash
23+
$ .\appStoreConnect.exe
24+
Required command was not provided.
25+
26+
Usage:
27+
appStoreConnect [options] [command]
28+
29+
Options:
30+
--version Show version information
31+
-?, -h, --help Show help and usage information
32+
33+
Commands:
34+
bundleIds create, update, list BundleIds
35+
bundleIdCapability enable, disable and modify BundleId-Capabilities
36+
certificates create, get, list or revoke certificates
37+
device, devices register, get, list or update devices
38+
p, profiles create, get, list or delete profiles
39+
userInvitation, userInvitations invite, get, list or cancel user invitations
40+
user, users update, get, list or delete a user | replace, remove or add apps to a user
41+
tools Tools for certification and jwt handling
42+
```
43+
44+
### Get a Bearer Token
45+
To interact with AppStoreConnect, you will need a valid OAuth Bearer token.
46+
Unfortunatley Apple doesn't provide an Endpoint for accquiring an OAuth token using a client-id and secret.
47+
To get a valid Bearer Token, you will need to create a APIKey and Certificate at [Users and Access](https://appstoreconnect.apple.com/access/api).
48+
49+
You either create a Bearer token yourself or use this app to create one.
50+
```bash
51+
appStoreConnect tools jwt create fromFile <PATH-TO-P8> <KID> <ISSUER ID>
52+
```
53+
54+
### Users-Endpoint
55+
```bash
56+
$ ./appStoreConnect.exe user
57+
Required command was not provided.
58+
59+
users:
60+
update, get, list or delete a user | replace, remove or add apps to a user
61+
62+
Usage:
63+
appStoreConnect users [options] [command]
64+
65+
Options:
66+
-?, -h, --help Show help and usage information
67+
68+
Commands:
69+
u, update <userId> <firstName> <lastName> <roles> <token> update a user by their id
70+
uj, ujson, updateFromJson <userId> <token> <json> update user from user json
71+
uf, ufile, updateFromFile <userId> <token> <file> update user from user json file
72+
g, get <userId> <token> get a user by their id
73+
l, list <token> list all users
74+
d, delete <userId> <token> delete a user by their id
75+
apps, la, linkedApps, lla <userId> <token> list all apps linked to a user by their id
76+
appIds, laid, linkedAppIds, llaid <userId> <token> list all appIds linked to a user by their id
77+
replaceApps <userId> <apps> <token> replace apps for a user by their id
78+
replaceAppsFromJson, replaceAppsJson <userId> <token> <json> replace apps for a user from List of Data json
79+
replaceAppsFile, replaceAppsFromFile <userId> <token> <file> replace apps for a user from List of Data json file
80+
removeApps <userId> <apps> <token> remove apps for a user by their id
81+
removeAppsFromJson, removeAppsJson <userId> <token> <json> remove apps for a user from List of Data json
82+
removeAppsFile, removeAppsFromFile <userId> <token> <file> remove apps for a user from List of Data json file
83+
addApps <userId> <apps> <token> add apps for a user by their id
84+
addAppsFromJson, addAppsJson <userId> <token> <json> add apps for a user from List of Data json
85+
addAppsFile, addAppsFromFile <userId> <token> <file> add apps for a user from List of Data json file
86+
87+
```
88+
89+
### UserInvitaions
90+
```bash
91+
$ ./appStoreConnect.exe userInvitation
92+
Required command was not provided.
93+
94+
userInvitations:
95+
invite, get, list or cancel user invitations
96+
97+
Usage:
98+
appStoreConnect userInvitations [options] [command]
99+
100+
Options:
101+
-?, -h, --help Show help and usage information
102+
103+
Commands:
104+
i, invite <email> <firstName> <lastName> <token> invite a user
105+
ij, ijson, inviteFromJson <token> <json> invite a new user from userInvitation json
106+
if, ifile, inviteFromFile <token> <file> invite a new user from userInvitation json file
107+
g, get <userInvitationId> <token> get a user invitation by its id
108+
l, list <token> list all userInvitations
109+
c, cancel <userInvitationId> <token> cancel a userInvitation by its id
110+
apps, la, linkedApps, lla <userInvitationId> <token> list all apps linked to a userInvitation by its id
111+
appIds, laid, linkedAppIds, llaid <userInvitationId> <token> list all appIds linked to a userInvitation by its id
112+
113+
```
114+
115+
### BundleId
116+
```bash
117+
$ ./appStoreConnect.exe bundleIds
118+
Required command was not provided.
119+
120+
bundleIds:
121+
create, update, list BundleIds
122+
123+
Usage:
124+
appStoreConnect bundleIds [options] [command]
125+
126+
Options:
127+
-?, -h, --help Show help and usage information
128+
129+
Commands:
130+
l, list <token>
131+
g, get <bundleIdId> <token>
132+
r, register <identifier> <name> <IOS|MAC_OS|UNIVERSAL> <token>
133+
registerFromJson, rj, rjson <token> <json> register a new bundleId from bundleId json
134+
registerFromFile, rf, rfile <token> <file> register a new bundleId from bundleId json file
135+
u, update <id> <token>
136+
d, delete <bundleIdId> <token>
137+
capabilities, lbc, list-linkedBundleIdCapabilities, llbc <bundleIdId> <token>
138+
capabilityIds, lbci, list-linkedBundleIdCapabilityIds, llbci <bundleIdId> <token>
139+
list-linkedProfiles, llp, lp, profiles <bundleIdId> <token> lists all profiles for given bundleId (no-content)
140+
list-linkedProfileIds, llpi, lpi, profileIds <bundleIdId> <token>
141+
142+
```
143+
144+
### BundleIdCapability
145+
```bash
146+
$ ./appStoreConnect.exe bundleIdCapability
147+
Required command was not provided.
148+
149+
bundleIdCapability:
150+
enable, disable and modify BundleId-Capabilities
151+
152+
Usage:
153+
appStoreConnect bundleIdCapability [options] [command]
154+
155+
Options:
156+
-?, -h, --help Show help and usage information
157+
158+
Commands:
159+
ej, ejson, enableFromJson <token> <json> enable capability from BundleIdCapability json
160+
ef, efile, enableFromFile <token> <file> enable capability from BundleIdCapability json file
161+
d, disable <capabilityId> <token>
162+
163+
```
164+
165+
### Devices
166+
```bash
167+
$ ./appStoreConnect.exe device
168+
Required command was not provided.
169+
170+
devices:
171+
register, get, list or update devices
172+
173+
Usage:
174+
appStoreConnect devices [options] [command]
175+
176+
Options:
177+
-?, -h, --help Show help and usage information
178+
179+
Commands:
180+
r, register <name> <APPLE_TV|APPLE_WATCH|IPAD|IPHONE|IPOD|MAC> <IOS|MAC_OS|UNIVERSAL> <udid> <token> register a new device
181+
registerFromJson, rj, rjson <token> <json> register a new device from device json
182+
registerFromFile, rf, rfile <token> <file> register a new device from device json file
183+
u, update <deviceId> <token> update a device
184+
uj, ujson, updateFromJson <token> <deviceId> <json> update a device from device json
185+
uf, ufile, updateFromFile <token> <deviceId> <file> update a device from device json file
186+
g, get <deviceId> <token> get a device by its id
187+
l, list <token> list all devices
188+
189+
```
190+
191+
### Certificates
192+
#### Creating a certificate
193+
To create a certificate you'll need a `Certificate Signing Request (CSR)`. To make it easier to create one you can just use a build-in cert-tool.
194+
```bash
195+
$ ./appStoreConnect.exe tools cert csr <COMMON NAME> <COUNTRY CODE> -o ./certificate-request.csr
196+
```
197+
There is also an `interactive`-mode of CSR creation
198+
```bash
199+
$ ./appStoreConnect.exe tools cert csri -o ./certificate-request.csr
200+
Creating a Certificate Signing Request
201+
Country Code* [C]: DE
202+
State or Province [ST]:
203+
Locality or City [L]: Dusseldorf
204+
Company [O]: SiaConsulting
205+
Organizational Unit [OU]:
206+
Common Name* [CN]: sia-consulting.eu
207+
Email Address [emailAddress]: info@sia-consulting.eu
208+
```
209+
You can then create a certificate by calling `appStoreConnect.exe certificate createFromFile <CERTIFICATE-TYPE> <BEARER-TOKEN> ./certificate-request.csr`
210+
```bash
211+
$ ./appStoreConnect.exe certificates cf
212+
Required argument missing for command: cf
213+
214+
createFromFile:
215+
create a new certificate from certificate json file
216+
217+
Usage:
218+
appStoreConnect certificates createFromFile [options] <type> <token> <file>
219+
220+
Arguments:
221+
<DEVELOPER_ID_APPLICATION|DEVELOPER_ID_KEXT|DEVELOPMENT|IOS_DEVELOPMENT|IOS_DISTRIBUTION|MAC_APP_DEVELOPMENT|MAC_APP_DISTRIBUTION|MAC_INSTALLER_DISTRIBUTION>
222+
<token>
223+
<file>
224+
225+
Options:
226+
-?, -h, --help Show help and usage information
227+
```
228+
After that you can download the Certificate (CER) from AppStoreConnect
229+
```bash
230+
$ ./appStoreConnect.exe certificates gc <CERTIFIACTE-ID> <BEARER-TOKEN> > ./certificate.cer
231+
```
232+
233+
To sign your app with that Certificate, you need to convert your CER Certificate to a PKCS12 Certificate.
234+
To make it easier you can use a built-in tool to create a PKCS12 certificate.
235+
```bash
236+
$ ./appStoreConnect.exe tools cert p12FromFile ./certificate.cer --password <PASSWORD> -o ./certificate.p12
237+
```
238+
239+
Here is the help output of the certifiactes command
240+
```bash
241+
dersia@DerSiaBook:/mnt/c/sources/AppStoreConnect/src/AppStoreConnectCli/bin/Debug/netcoreapp3.1$ ./appStoreConnect.exe certificates
242+
Required command was not provided.
243+
244+
certificates:
245+
create, get, list or revoke certificates
246+
247+
Usage:
248+
appStoreConnect certificates [options] [command]
249+
250+
Options:
251+
-?, -h, --help Show help and usage information
252+
253+
Commands:
254+
c, create <csrContent> <DEVELOPER_ID_APPLICATION|DEVELOPER_ID_KEXT|DEVELOPMENT|IOS_DEVELOPMENT|IOS_DISTRIBUTION|MAC_APP_DEVELOPMENT|MAC_APP_DISTRIBUTION|MAC_INSTALLER_DISTRIBUTION> <token>
255+
create a new certificate
256+
cf, cfile, createFromFile <DEVELOPER_ID_APPLICATION|DEVELOPER_ID_KEXT|DEVELOPMENT|IOS_DEVELOPMENT|IOS_DISTRIBUTION|MAC_APP_DEVELOPMENT|MAC_APP_DISTRIBUTION|MAC_INSTALLER_DISTRIBUTION> <token> <file>
257+
create a new certificate from certificate json file
258+
g, get <certificateId> <token>
259+
get a certificate by its id
260+
gc, getContent <certificateId> <token>
261+
get a certificate content by its id
262+
ge, getEntry <certificateId> <token>
263+
get a certificate without its content by its id
264+
l, list <token>
265+
list all certificates (no content)
266+
r, revoke <certificateId> <token>
267+
revoke a certificate by its id
268+
269+
```
270+
271+
### Profiles
272+
```bash
273+
dersia@DerSiaBook:/mnt/c/sources/AppStoreConnect/src/AppStoreConnectCli/bin/Debug/netcoreapp3.1$ ./appStoreConnect.exe profiles
274+
Required command was not provided.
275+
276+
profiles:
277+
create, get, list or delete profiles
278+
279+
Usage:
280+
appStoreConnect profiles [options] [command]
281+
282+
Options:
283+
-?, -h, --help Show help and usage information
284+
285+
Commands:
286+
c, create <name> <IOS_APP_ADHOC|IOS_APP_DEVELOPMENT|IOS_APP_INHOUSE|IOS_APP_STORE|MAC_APP_DEVELOPMENT|MAC_APP_DIRECT|MAC_APP_STORE|TVOS_APP_ADHOC|TVOS_APP_DEVELOPMENT|TVOS_APP_INHOUSE|TVOS_APP_STORE> <token>
287+
create a new profile
288+
cj, cjson, createFromJson <token> <json>
289+
create a new profile from profile json
290+
cf, cfile, createFromFile <token> <file>
291+
create a new profile from profile json file
292+
g, get <profileId> <token>
293+
get a profile by its id
294+
gc, getContent <profileId> <token>
295+
get a profile content by its id
296+
ge, getEntry <profileId> <token>
297+
get a profile by its id(without content)
298+
l, list <token>
299+
list all profiles
300+
d, delete <profileId> <token>
301+
delete a profile by its id
302+
bundleId, lbi, linkedBundleId, llbi <profileId> <token>
303+
get bundleId linked to a profile
304+
bundleIdId, lbiid, linkedBundleIdId, llbiid <profileId> <token>
305+
get bundleIdId linked to a profile
306+
certificates, lc, linkedCertificates, llc <profileId> <token>
307+
list all certificates linked to a profile
308+
certificateIds, lcid, linkedCertificateIds, llcid <profileId> <token>
309+
list all certificateIds linked to a profile
310+
devices, ld, linkedDevices, lld <profileId> <token>
311+
list all devices linked to a profile
312+
deviceIds, ldid, linkedDeviceIds, lldid <profileId> <token>
313+
list all deviceIds linked to a profile
314+
315+
```
316+
317+
## Future plans
318+
In the future APIs for TestFlight and Reporting Endpoints will be added.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.1</TargetFramework>
5+
<LangVersion>8.0</LangVersion>
6+
<Nullable>enable</Nullable>
7+
<AssemblyName>SiaConsulting.AppStoreConnect.Jwt</AssemblyName>
8+
<RootNamespace>AppStoreConnect.Jwt</RootNamespace>
9+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
10+
<Version>0.2.0.0</Version>
11+
<Authors>Sia Consulting Ltd.</Authors>
12+
<Product>Jwt extension for AppStoreConnect Lib</Product>
13+
<PackageId>SiaConsulting.AppStoreConnect.Jwt</PackageId>
14+
<Description>Library to Create a Jwt Token to interact with Apples AppStoreConnect API</Description>
15+
<Copyright>2019 Sia Consulting Ltd.</Copyright>
16+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
17+
<PackageProjectUrl>https://github.com/dersia/AppStoreConnect</PackageProjectUrl>
18+
<RepositoryUrl>https://github.com/dersia/AppStoreConnect.git</RepositoryUrl>
19+
<RepositoryType>github</RepositoryType>
20+
</PropertyGroup>
21+
22+
<ItemGroup>
23+
<None Include="..\\..\\LICENSE" Pack="true" PackagePath="" />
24+
</ItemGroup>
25+
26+
<ItemGroup>
27+
<ProjectReference Include="..\AppStoreConnect\AppStoreConnect.csproj" />
28+
</ItemGroup>
29+
30+
</Project>

0 commit comments

Comments
 (0)