question

newuser-e2377693-0f5b-412b-aae8-5dc66a4a5d59 avatar image

ETag is is missing when getting apk list

I'm trying to implement the Replace APK flow using the reference:

get_apks_path = '/v1/applications/%s/edits/%s/apks' % (app_id, edit_id)
get_apks_url = BASE_URL + get_apks_path
apks = requests.get(get_apks_url, headers=headers)

firstAPK = apks[0]
apk_id = firstAPK['id']
replace_apk_path = '/v1/applications/%s/edits/%s/apks/%s/replace' % (app_id, edit_id, apk_id)

## Open the apk file on your local machine
local_apk = open(local_apk_path, 'rb').read()

replace_apk_url = BASE_URL + replace_apk_path
all_headers = {    'Content-Type': 'application/vnd.android.package-archive',    'If-Match': etag
}
all_headers.update(headers)
replace_apk_response = requests.put(replace_apk_url, headers=all_headers, data=local_apk)


The problem is that in the response for requests.get(get_apks_url, headers=headers)
I'm missing the ETag that I need in order to replace the existing apk.

app submission and updatesapi
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

K R avatar image
K R answered

You need to get an individual APK to get the ETag, not the entire list. So you might need an additional step after fetching the list to fetch the single APK solely for the purpose of getting the ETag.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.