REST request returning Invalid report suite

I am trying to use QueueRanked with a REST GET request and receiving this back in return each time: {"status":"error 5020","statusMsg":"Invalid report suite","reportID":0}

I am hitting the url encoded version of:

https://api2.omniture.com/admin/1.2/rest/?method=Report.QueueRanked&auth_username=<user>:<company>&auth_digest=<digest>&auth_nonce=<nonce>&auth_created=2010-05-04T16:50:59&reportDescription={"reportSuiteID":"<report suite>",+"dateFrom":"2010-03-01",+"dateTo":"2010-04-30",+"metrics":[{"id":"pageViews"}],+"elements":[{"id":"page","top":"1","selected":["<page name>"]}]}

which looks something like:

https://api2.omniture.com/admin/1.2/rest/?method=Report.QueueRanked&auth_username=<user>:<company>&auth_digest=<digest>&auth_nonce=<nonce>&auth_created=2010-05-04T16:50:59&reportDescription=%7B%22reportSuiteID%22%3A%22%3Creport%20suite%3E%22%2C%2B%22dateFrom%22%3A%222010-03-01%22%2C%2B%22dateTo%22%3A%222010-04-30%22%2C%2B%22metrics%22%3A%5B%7B%22id%22%3A%22pageViews%22%7D%5D%2C%2B%22elements%22%3A%5B%7B%22id%22%3A%22page%22%2C%22top%22%3A%221%22%2C%22selected%22%3A%5B%22%3Cpage%20name%3E%22%5D%7D%5D%7D

The same exact request works from the Web Services Explorer, with an identical reportSuiteID. What is wrong in this request?

The request is originating from Python if that matters. I have tried GET and POST and have had the same issue.

 

First, I would suggest switching to using a POST for Report.QueueRanked, with the content body of the POST being the JSON structure as seen in the API Explorer. While technically possible, getting the url encoding right for the complicated structure the Report API requires can be a headache. The only query string parameters to add to the URL would be the auth-related ones: The raw HTTP request should look something like: POST /admin/1.2/rest/?method=Report.QueueRanked&auth_username=:&auth_digest=&auth_nonce=&auth_created=2010-05-04T16:50:59 HTTP/1.1 Host: https://api2.omniture.com/ Content-Length: XXX { "reportDescription":{ "reportSuiteID":"", "date":"", "dateFrom":"", "dateTo":"", "dateGranularity":"ENUM( 'hour', 'day', 'week', 'month', 'quarter', 'year')", "metrics":[] } .... } Let us know if that helps!
Reply

 

Following is my code, when i run this i am getting "Invalid report ID" as status message, can you please help me out.
String[] reportSuites = {"myReportSuite"};
ReportDescription reportDescription = new ReportDescription();
ReportDefinitionMetric reportDefinitionMetric = new ReportDefinitionMetric();
reportDefinitionMetric.setId("pageViews");
ReportDefinitionMetric[] metrics = {reportDefinitionMetric};
reportDescription.setDateFrom(reportFromDate);
reportDescription.setDateTo(reportToDate);
reportDescription.setLocale(new ReportDefinitionLocale("en_US"));
reportDescription.setReportSuiteID(reportSuites[0]);
reportDescription.setMetrics(metrics);
       
ReportQueueResponse response = port.reportQueueOvertime(reportDescription);
int reportID = response.getReportID();
ReportResponse reportResponse = new ReportResponse();
String statusMessage = "";
reportResponse = port.reportGetReport(reportID);
statusMessage = reportResponse.getStatusMsg();
Reply

Hi Swapnildha,

First, I would put in some error checking code to make sure that the call to "reportQueueOvertime" returns a reportID that is greater than zero. If there was an error you'll not only get an error in the "status" part of the response but you'll get a "reportID" equal to zero. If you call "reportGetReport" with its reportID parameter set to zero you'll get the "Invalid report ID" message that you are experiencing.

Hope that helps.

-Sean

Reply

Thanks for response. You are right I am getting a report id as a zero .

But can you please explore what are the reason because of  that I am getting 0 as report id as I am using correct reportsuiteid, metrics and date param. I am tring to fetch SiteCatalyst report for various traffic sources (like Search Keywords -  Paid,Search Keywords -  Natural etc) for different report suites. Can you please explore on this? 

Reply

If you want to get some help you're going to need to supply some details. Such as, 1) the specific report description you are queuing up, and 2) the error status message in your response back from the "reportQueueOvertime" method.

Reply

Thnaks. My privous problem is solved. Now I am facing a another one. I am tring to get first 50 rows from report. But I am getting only total values for all matrics I have added in report defination. Can you please tell me where am I going wrong. Is there any method from where I can directly download report file to my local disk. Following is my code.

EngineConfiguration config = new FileProvider("client_deploy.wsdd");
PWCallback pwCallback = new PWCallback();
OmnitureWebServiceLocator service = new OmnitureWebServiceLocator(config);
OmnitureWebServicePortType port = (OmnitureWebServicePortType) service.getOmnitureWebServicePort();
String[] reportSuites = {"myreportsuitid"};
String reportDate = "2011-09-09";
ReportDescription reportDescription = new ReportDescription();        
ReportDefinitionMetric reportDefinitionMetric = new ReportDefinitionMetric();
reportDefinitionMetric.setId("pageViews");
ReportDefinitionMetric reportDefinitionRevenueMetric = new ReportDefinitionMetric();
reportDefinitionRevenueMetric.setId("revenue");
ReportDefinitionMetric reportDefinitionCartMetric = new ReportDefinitionMetric();
reportDefinitionCartMetric.setId("cartAdditions");
ReportDefinitionMetric reportDefinitionUnitsMetric = new ReportDefinitionMetric();
reportDefinitionUnitsMetric.setId("units");
ReportDefinitionMetric[] metrics = {reportDefinitionMetric,reportDefinitionRevenueMetric,reportDefinitionCartMetric,reportDefinitionUnitsMetric};
ReportDefinitionElement rdElementNatural = new ReportDefinitionElement();
rdElementNatural.setId("searchEngineNaturalKeyword");
rdElementNatural.setTop(50);
rdElementNatural.setStartingWith(1);
ReportDefinitionElement[] elements = {rdElementNatural};
reportDescription.setDate(reportDate);
reportDescription.setLocale(new ReportDefinitionLocale("en_US"));
reportDescription.setReportSuiteID(reportSuites[0]);
reportDescription.setMetrics(metrics);
reportDescription.setElements(elements);
ReportQueueResponse response = port.reportQueueOvertime(reportDescription);
int reportID = response.getReportID();
ReportResponse reportResponse = new ReportResponse();
Report_status rs = new Report_status();
String statusMessage = "";
rs = port.reportGetStatus(reportID);
statusMessage = rs.getStatus();
//Your report has finished generating
if(!statusMessage.equals("done")){
 do{
  rs = port.reportGetStatus(reportID);
         statusMessage = rs.getStatus();
         Thread.sleep(2000);
   }
   while(!statusMessage.equals("done"));
}
reportResponse = port.reportGetReport(reportID);
Report report = reportResponse.getReport();
ReportData[] reportData = report.getData();
for(int j = 0; j < reportData.length; j++){
 double[] counts = reportData[j].getCounts();
 for(int k = 0; k < counts.length; k++){
      System.out.println(" - "  + counts[k]);
 }
}

Reply

If you want to see the metrics broken out by each keyword then you need to queue up a "ranked" report (using reportQueueRanked method) rather than using "reportQueueOvertime".

-Sean

Reply

when I am using reportQueueRanked method, I am getting a reportID but getStatus() method return "failed" as a status message. following changes I have done in my above posted code,

Insted of :-  ReportQueueResponse response = port.reportQueueOvertime(reportDescription);

 

I am using :- ReportQueueResponse response = port.reportQueueRanked(reportDescription);
Reply

If you get a "failed" status then you will also get an error message included in the response. This should help you to figure out the problem. What is the error message you are seeing?

Reply

Thanks. My problem resolved. Actually I am getting "Invalid mixing of commerce and traffic metrics" as I am adding "pageViews" with "revenue","cartAdditions" & "units" matrics. When I removed "pageVIew", I am able to get report data.

But I need "pageView" matric in my report. I also want "search" and "order" matric in a same report. But unable to find the value for them. Can is use "totalOrder" as "order matric.  Do we have any method to download the report on local drive as in SiteCatalyst site we can download the report or we can send the report as email.

Reply

Must be logged in to comment. now to comment!