Search code examples
app-store-connectapple-reporter

Apple Reporter Sales.getReport Too few or too many parameters specified for the method


I'm integrating the Apple Reporter.jar to download my app sales reports, but it's complaining that I have either too few or too many arguments.

Too few or too many parameters specified for the method. Call ApplicationName.getHelp for a list of valid methods and their parameters.

When I call Sales.getHelp it tells me the params should be:

Usage: java -jar Reporter.jar p=[properties file] m=["Normal"|"Robot.XML"] a=[account number] Sales.[command] [arguments] 
where commands include: 
     getHelp: Returns this help message. No arguments. 
     getStatus: Returns status of Sales and Trends application. No arguments. 
     getAccounts: Returns list of available accounts. No arguments. 
     getVendors: Returns list of available vendor numbers. No arguments.  
     getReport: Downloads a report. Arguments: Vendor Number, Report Type, Report Subtype, DateType, Date. 

So, if I want to perform the Sales.getReport command, it appears that I need the following params:

java -jar Reporter.jar p=[properties file] m=["Normal"|"Robot.XML"] a=[account number] Sales.getReport Vendor_Number Report_Type Report_Subtype DateType Date

This is the command I used (with my real account number and vendor number that I got via the Reporter):

java -jar Reporter.jar p=Reporter.properties m="Normal" a="XXXXXX" Sales.getReport YYYYYYY Sales Summary Daily 20170130

As far as I can tell, all of those match up properly:

1) java -jar Reporter.jar | java -jar Reporter.jar
2) p=[properties file] | p=Reporter.properties 
3) m=["Normal"|"Robot.XML"] | m="Normal" 
4) a=[account number] | a="XXXXXX" 
5) Sales.getReport | Sales.getReport 
6) Vendor_Number | YYYYYYY 
7) Report_Type | Sales 
8) Report_Subtype | Summary 
9) DateType | Daily
10) Date | 20170130

I tried adding an extra asdf on the end to see if it wanted one more param but it gave me the same message. Then I tried removing params and it gave me the same error message all the way until I removed Sales.getReport.

Am I doing something wrong or is their error message just completely wrong/unhelpful?


Solution

  • Ok, whatever Apple engineers created the Reporter.jar need to be fired.

    The problem was that I needed to put COMMAS in between my command line parameters. Like absolutely NO other command line usage in the history of command line usages. It appears that everything after Sales.getReport is slurped in by the code, smashed together into one string and then split on commas AND ONLY THEN does it check the params.

    Because I even tried just sending "YYYYYYY Sales Summary Daily 20170130" as a single string, to test my hypothesis that it wanted a single command line argument, but that didn't work.

    Here is the command that finally worked for me:

    java -jar Reporter.jar p=Reporter.properties m="Normal" a="XXXXXX" Sales.getReport YYYYY, Sales, Summary, Daily, 20170129

    I have no idea what those Apple engineers were thinking when they designed this, but they should be fired. I expect Apple engineers to be some of the best around, but this is amateurish and ignorant of all standard command line practices.</rant>