Cannot delete old apk after creating new edit (App Submission API)

I am trying to use App Submission API to automate the release of new builds.

I am able to successfully create a new edit. When it creates, it contains an apk from my live version uploaded. I would like to remove it before uploading a new one.

This behaviour must be supported as it is covered by the docs

If you want to replace an APK and delete the current targeting information, delete the APK and then upload the new version of the APK.

I am following the full process described in the docs:

  1. List all apps contained in edit by issuing GET /{apiVersion}/applications/{appId}/edits/{editId}/apks (SUCCESSFUL)
  2. For each apk, get its info to receive Etag by calling GET /{apiVersion}/applications/{appId}/edits/{editId}/apks/{apkId} (SUCCESSFUL)
  3. Finally, DELETE /{apiVersion}/applications/{appId}/edits/{editId}/apks/{apkId} (FAIL)

The last step fails with the following error:

{
"httpCode":400,
"message":"Bad Request",
"errors":[
    {
    "errorCode":"error_apk_version_already_uploaded",
    "errorMessage":"Failed to upload APK. The version codes of all uploaded APKs in an app must be unique. The APK you just uploaded with version code 94 conflicts with the version code of an existing APK in the current version."
    }
]}

I am calling my DELETE request with If-Match header set to etag from step 2. If I try to run it without it, I receive a different error.

Looks like App Submission API has a bug and does not let us delete the apk version from the edit which gets copied from existing version upon creation of an edit. This is unfortunate as I want to delete it specifically to reset targeting.

Also, it is possible to delete it from the console.

I have tried a new approach and prior to deleting existing APK I uploaded a new one. The result is the same.

Looks like DELETE apk endpoint has a bug and assumes that I am doing an upload, not the deletion :slight_smile:

Hi @Andriy_Gordiychuk ,

Our app submission team will need your developer and app ID to investigate this issue. Because this is sensitive information that shouldn’t be shared on the forum, can you please use the Contact Us form to send us this information?

Please don’t forget to summarize the issue and provide a link to this post in your contact us case, so our support team will know the context.

Thanks,

Moses

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.