Hi, when I request SalesReport via Connect API, I get 403 error. However, until December 28, it was working normally. I've tried creating a new api key, but it's still a 403. Can anyone help me or tell me how to troubleshoot this? Thanks
ERROR MESSAGE
{'errors': [{'id': '***', 'status': '403', 'code': 'FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED', 'title': 'A required agreement is missing or has expired.', 'detail': 'This request requires an in-effect agreement that has not been signed or has expired.', 'links': {'see': '/agreements'}}]}
CODE
import time
import requests
import jwt
KEY_ID = "***"
ISSUER_ID = "x-x-x-x-x"
EXPIRATION_TIME = int(round(time.time() + (20 * 60)))
PRIVATE_KEY = open('PATH_TO_KEY', 'r').read()
header = {
"alg": "ES256",
"kid": KEY_ID,
"typ": "JWT"
}
payload = {
"iss": ISSUER_ID,
"exp": EXPIRATION_TIME,
"aud": "appstoreconnect-v1"
}
token = jwt.encode(payload=payload, key=PRIVATE_KEY, headers=header, algorithm='ES256')
URL = 'https://api.appstoreconnect.apple.com/v1/salesReport'
HEAD = {'Authorization': 'Bearer %s' % token}
params = {
'filter[frequency]': 'DAILY',
'filter[reportDate]': '2022-02-01',
'filter[reportSubType]': 'SUMMARY',
'filter[reportType]': 'SALES',
'filter[vendorNumber]': 'my vendor number',
}
r = requests.get(URL, params=params, headers=HEAD)
print(r.status_code) # return 403