我正在设置CI/CD应用程序部署以将构建上载到TestFlight/AppStore,因此需要在构建之前检查之前从app Store Connect上载的构建版本
我已经生成了使用App Store Connect API进行身份验证所需的JWT令牌,并从以下位置获取了应用id:https://api.appstoreconnect.apple.com/v1/apps
现在,我使用:https://api.appstoreconnect.apple.com/v1/apps/{ id }/builds请求与该应用程序id相关的构建
这给了我这样的响应(响应数据是分页的(偏移量/限制),不是按照上传的构建版本排序的) :-
{
"data": [
{
"type": "preReleaseVersions",
"id": "<resource id>",
"attributes": {
"version": "1.3",
"platform": "IOS"
},
<some additional trees>
},
{
"type": "preReleaseVersions",
"id": "<resource id>",
"attributes": {
"version": "1.4",
"platform": "IOS"
},
<some additional trees>
},
{
"type": "preReleaseVersions",
"id": "<resource id>",
"attributes": {
"version": "1.2",
"platform": "IOS"
},
<some additional trees>
},
<some more data...>
],
"meta": {
"paging": {
"total": 55,
"limit": 50
}
}
}
我正在寻找的是一些查询字符串参数或不同的API或方法,我可以从中获得最新的构建版本,而不需要递归调用API来获取所有上传的版本,然后从数组中查找最大的版本
发布于 2020-05-09 09:43:32
我还没有找到一个简单的方法,但这是我想出的最好的方法。
https://api.appstoreconnect.apple.com/v1/builds?filter[app]={app_id}&sort=-version&fields[builds]=version&filter[preReleaseVersion.version]={version_num}&limit=1
这将返回类似如下的内容:
{
"data": [
{
"type": "builds",
"id": "ef87f7e1-20e0-4128-9c4d-7aadb23b23ed",
"attributes": {
"version": "30"
},
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/ef87f7e1-20e0-4128-9c4d-7aadb23b23ed"
}
}
],
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds?filter%5BpreReleaseVersion.version%5D=1.2.11&limit=1&sort=-version&filter%5Bapp%5D=&fields%5Bbuilds%5D=version",
"next": "https://api.appstoreconnect.apple.com/v1/builds?cursor=AQ.GXQEGw&filter%5BpreReleaseVersion.version%5D=1.2.11&limit=1&sort=-version&filter%5Bapp%5D=&fields%5Bbuilds%5D=version"
},
"meta": {
"paging": {
"total": 29,
"limit": 1
}
}
}
从这里你只需要抓取“版本”即可。这很让人困惑,但在这种情况下,版本是内部版本号。
这种方法有一个问题。有时,苹果不会处理一个构建,即使它上传了。由于某些原因,这些构建不会出现在此请求中。我不明白为什么苹果在这件事上如此固执。尽管如此,我已经注意到FastLane能够获得最新的构建,但我还没有对他们的过程进行反向工程。
发布于 2019-07-27 03:01:11
您可以通过检查为特定preleaseVersion
上载的构建来限制搜索
params = { 'filter[version]' => short_bundle_version }
GET https://api.appstoreconnect.apple.com/v1/preReleaseVersions
这将返回包含与该版本关联的构建的urls的元数据。然后您可以提取相关的构建urls:
json['relationships']['builds']['links']['related']['data']
,
然后请求url的相关JSON,它将包含构建ID及其uploadDate
。
https://stackoverflow.com/questions/56362852
复制相似问题