testflight_invite
testflight_invite copied to clipboard
Python add tester not working
When I try to add a tester using python testflight_invite.py <iTC_email> <appId> <email>
I'm able to login successfully but the response is a 405 Method not allowed error.
Don't have time at the moment to submit a proper PR, but this is the edit that I made to resolve the problem for myself:
@@ -205,18 +205,23 @@ class TestFlightInvite:
testerResponseBody = json.loads(text)
testerId = testerResponseBody['data']['id']
- params = {
- 'groupId': self.groupId,
- 'testerId': testerId,
- }
return self.readData(
- 'https://itunesconnect.apple.com/testflight/v2/providers/{teamId}/apps/{appId}/groups/{groupId}/testers/{testerId}'.format(
- teamId=self.contentProviderId, appId=self.appId, groupId=self.groupId, testerId=testerId
+ 'https://itunesconnect.apple.com/testflight/v2/providers/{teamId}/apps/{appId}/groups/{groupId}/testers'.format(
+ teamId=self.contentProviderId, appId=self.appId, groupId=self.groupId
),
- json.dumps(params),
- headers={'Content-Type': 'application/json'},
- method='PUT'
+ json.dumps([
+ {'email': email, 'firstName': firstname, 'lastName': lastname},
+ ]),
+ headers={
+ 'Content-Type': 'application/json',
+ 'Origin': 'https://itunesconnect.apple.com',
+ 'Pragma': 'no-cache',
+ 'Referer': 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/1338963243/testflight?section=group&subsection=testers&id=a30838f7-e002-44f6-98c0-74c7918f3fc8',
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36',
+ 'X-Csrf-Itc': 'itc',
+ },
+ method='POST'
)
Basically they changed the endpoint used to add testers to a group. The testerId is no longer part of the URL, the request should POST instead of PUT, and the body should be a LIST of objects, each containing email, firstname, and lastname. I also included some headers that I thought they might be validating, not sure if that was important or not.