我要生成一个配置文件,但是服务器返回500,并且没有可用的提示。
我对其他函数没有问题,但是当我创建配置文件时,出现了这个问题。我该如何解决这个问题?我给苹果发了电子邮件,但没有收到回复。
那么是参数错误导致服务器返回500,还是Apple服务器有问题?
那么,是参数错误导致服务器返回500,还是Apple服务器有问题?因为我没有找到相关的示例代码,所以我无法确定是什么导致了这个问题。
Endpoint specification document
HTTP请求:
POST https://api.appstoreconnect.apple.com/v1/profilespython代码:
def registerProfile(token, identifier, udid, certificateID):
data = dict(
data=dict(
type='profiles',
attributes=dict(
name='xxxxx',
profileType='IOS_APP_ADHOC'
),
relationships=dict(
bundleId=dict(
data=dict(
type='bundleIds',
id=identifier
)
),
certificates=dict(
data=dict(
type='certificates',
id=certificateID
)
),
devices=dict(
data=dict(
type='devices',
id=udid
)
)
)
)
)
result = requestUtils.post(token, URL.registerProfile, data)
print(result.text)
try:
id = json.loads(result.content.decode())['data']['id']
except BaseException:
return False
return id错误响应:
{
"errors": [{
"status": "500",
"code": "UNEXPECTED_ERROR",
"title": "An unexpected error occurred.",
"detail": "An unexpected error occurred on the server side. If this issue continues, contact us at https://developer.apple.com/contact/."
}]]
}发布于 2020-04-08 03:19:51
在relationships对象中,字段certificates.data和devices.data应该是数组,而您已经定义了字典。
请分别参阅字段的相关文档页面:https://developer.apple.com/documentation/appstoreconnectapi/profilecreaterequest/data/relationships/certificates
因此,应该做出以下改变:
certificates=dict(
data=[dict(
type='certificates',
id=certificateID
)]
),
devices=dict(
data=[dict(
type='devices',
id=udid
)]
) 不幸的是,API并没有返回更好的错误响应,而只是生成了一个服务器错误。但是如果请求资源id和头都是正确的,这些更改应该会产生一个适当的响应(我遇到了和您一样的问题,这就是问题的原因)。
https://stackoverflow.com/questions/57265320
复制相似问题