For the Itunes Reporter API, I have an access_token and vendor_number.
https://help.apple.com/itc/appsreporterguide/#/apd68da36164
I found some old Python code that was used to send API requests to this API:
def _make_request(self,
cmd_type: str,
command: str,
credentials: Dict[str, str],
extra_params: Dict[str, str] = None
) -> requests.Response:
if not extra_params:
extra_params = {}
# command does not differ anymore, no matter if the apple id has multiple accoutns or not. a= is an invalid parameter by now.
command = f'[p=Reporter.properties, {cmd_type.capitalize()}.{command}]'
endpoint = ('https://reportingitc-reporter.apple.com'
f'/reportservice/{cmd_type}/v1')
# account needs to be passed as data, not as parameter
if self.account:
data = {
'version': self.version,
'mode': self.mode,
**credentials,
'queryInput': command,
'account': self.account
}
else:
data = {
'version': self.version,
'mode': self.mode,
**credentials,
'queryInput': command
}
data = self._format_data(data)
data.update(extra_params)
response = requests.post(endpoint, data=data)
response.raise_for_status()
return response
def download_sales_report(self,
vendor: str,
report_type: str,
date_type: str,
date: str,
report_subtype: str = '',
report_version: str = '') -> Data:
"""Downloads sales report, puts the TSV file into a Python list
Information on the parameters can be found in the iTunes Reporter
documentation:
https://help.apple.com/itc/appsreporterguide/#/itcbd9ed14ac
:param vendor:
:param report_type:
:param date_type:
:param date:
:param report_subtype:
:param report_version:
:return:
"""
credentials = {
'accesstoken': self.access_token
}
command = (f'getReport, {vendor},{report_type},{report_subtype},'
f'{date_type},{date},{report_version}')
ordered_dict_sales_report = self._process_gzip(self._make_request('sales', command,
credentials))
return ordered_dict_sales_report
Now, I want to replicate this in Postman but I am not sure where to place the parameters from the "command" i.e vendor, reportType etc. Do I pass them as a raw json in the body? Or as query paramas?
The endpoint I am using currently for a POST request is this:
https://reportingitc-reporter.apple.com/reportservice/sales/v1
I am passing a "BearerToken" as the authorization and this as the Body:
{
"version": "1.0",
"mode": "Test",
"queryInput": "[p=Reporter.properties, Sales.getReport, 85040615, sales, Summary, Daily, 20230101]"
}
but i get 400 Bad request error
According to the documentation, this is the Java syntax that i need to convert to Python:
Syntax
$ java -jar Reporter.jar p=[properties file] Sales.getReport [vendor number], [report type], [report subtype], [date type], [date], [version]* (if applicable)