Unable to use the amazon API

So I followed the below guide and although I’m able to receive an access token, with that access token I’m unable to get any response with the access token when I use it on developer.amazon.com/api/appstore.

I tried to send the request using the auth bearer token and I always found out that it gives a 500 internal server error as shown in the below screenshot, can anyone help on this issue.

Screenshot 2024-08-07 at 00.46.30

Hi habeeb,

Thanks for posting! Please try the following script, replacing the required values (path, access token, etag, etc) with ones from your own account, and see if it works for you:

import sys
import requests
import json
import os

upload_apk_url = "https://developer.amazon.com/api/appstore/v1/applications/amzn1.devportal.mobileapp.5b33f51f14a64899bd3f278b62e47abc/edits/amzn1.devportal.apprelease.492f1de7263543b1b232dfcc4ecc4abc/apks/upload"
LOCAL_APK_PATH = "your-app.apk"
ACCESS_TOKEN = "Atc|ACTUAL-ACCESS-TOKEN-HERE"
local_apk = open(LOCAL_APK_PATH, 'rb').read()
etag = '21537c98a3dd154e6cd53ec5a281023abc2fa666'
apk_file_name = 'your-app'
all_headers = {
    'Content-Type': 'application/vnd.android.package-archive',
    'fileName': apk_file_name,
    'If-Match': etag,
    'Authorization': "Bearer " + ACCESS_TOKEN
}
upload_apk_response = requests.post(upload_apk_url, headers=all_headers, data=local_apk)
print(upload_apk_response.content)