2

I am not able to see any report through Salesforce API.

My Connected App is created.

The result of this call:

/services/data/v29.0/analytics

is:

{"report":"/services/data/v29.0/analytics/reports"}

but the result of:

/services/data/v29.0/analytics/reports

is :

[]

I am able to see SOME reports using the administrator credentials only, but not able to do the same with another users.

I have even cloned the administrator profile and assigned to a user to do my tests, but does not worked.

Any suggestion?

Thank you

2

The accessing of reports depend on Folder permissions rather than profile .Does your profile has folder access to the reports ?Analytic API also looks for the folder permissions .If your user has no folder access you wont be able to view those reports .

  • I realized that the reports created by the logged user are available, I mean, by calling to /services/data/v29.0/analytics/reports if the logged user has created a report, that report will come in the response. Anyway, I'm interested in the default reports.. – user8145 Apr 30 '14 at 20:33
  • I have shared many report Folders to all all users, individual users, groups, but without success – user8145 Apr 30 '14 at 20:36
  • The profile has the "View Reports in Public Folders" permission checked – user8145 Apr 30 '14 at 20:53
2

The URL that you are accessing, /services/data/v29.0/analytics/reports, is the List resource which doesn't list every report, but rather just the reports recently viewed by the user.

What you are observing is likely consistent with the expected behavior. With each user you test with, you are only seeing those reports recently viewed by that particular user, which in some cases must be none.

To get information about every report, you must query the Report object.

for (Report r : [SELECT Id, Name FROM Report]) {
   // do something
}

The documentation on the List resource:

Displays a list of up to 200 tabular, matrix, or summary reports that you recently viewed. To get a full list of reports by format, name, and other fields, use a SOQL query on the Report object.

/services/data/<latest API version>/analytics/reports

  • thank you!. This query worked: /services/data/v29.0/query/?q=SELECT+Description,Format,LastRunDate+FROM+Report+WHERE+Format+=+'SUMMARY'" . I tried with every one of the four types of reports (MATRIX, TABULAR, SUMMARY and JOIN) but I only received 9 reports when using the SUMMARY value, the other values return empty, I'm still missing something because, only the standard reports are more than 100 in salesforce. – user8145 May 5 '14 at 16:12
  • Sorry, I'm not sure what else could be going on. I would think that it would work for querying the table. Only other thing that I could think of outside of what has been said, is that the value in the WHERE clause is not what you expect it to be. For example, there might be a leading or trailing whitespace that is going unnoticed, so that instead of checking against 'MATRIX', you are checking against ' MATRIX' (note the leading space). – Peter Knolle May 6 '14 at 4:02
  • Without the WHERE clause, the result is the same 9 reports. Anyway, now I know how to clone reports and put them into a folder that is accesible to another users, so I can live with that for now. Thank you! – user8145 May 6 '14 at 13:07
  • I checked the values and all are fine, no typos or whitespaces, thank you! – user8145 May 6 '14 at 22:29
0

Here is how I got some acceptable results:

  1. Logged as Admin, create a reports' Folder.

  2. Move the reports you want to get from API to that folder.

  3. In the reports' list, look for your folder and click over the dropdown arrow that appears next to it; A set of options will be shown, then, select the Share option and share it to users, roles, or groups you want to give access to the reports via API.

  4. In your app (I have a .net project for that) query all reports with a something like this:

HttpGet(token.instance_url + @"/services/data/v29.0/query/?q=SELECT+Name,Description,DeveloperName,Format,IsDeleted,LastReferencedDate,LastRunDate,LastViewedDate,NamespacePrefix,OwnerId+FROM+Report+ORDER+BY+Name+ASC", "");

This in my case, returns metadata information of reports within the created Folder. This metadata information contains report identifiers. Eg. 00Oi0000005iqNhFEI, but does not contains the real report information (the records, the tables and sales information)

5 . To get real data of a specific report, it is needed to perform another query using the identifier of the report you want to retrieve. You can do it with something like:

HttpGet(token.instance_url + @"/services/data/v29.0/analytics/reports/00Oi0000005iqNhFEI?includeDetails=true", "");

Note that I'm using the report's identifier and also the "analytics" path and well, this query is the one that will give you the real report data.

Hopely this will help somebody.

I'm pretty sure this is not the best technical explanation but really, that is the way I got it working.

Any comments, critics, tips, anything are always welcome.

Thank you to Peter Knolle and Mohith Kumar for the help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.