function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
aezellaezell 

Accessing Reports via API

Is it possible to access Report objects via the API?

That is, I have saved several reports to the Unfiled Public Reports and I would like to be able to get them via the Apex API.
SuperfellSuperfell
Nope. Please vote for this on the idea exchange.
aezellaezell
Thanks Simon.

I couldn't find an existing one to vote for, so I made my own:
 http://ideas.salesforce.com/article/show/77356/API_Access_to_Reports


Message Edited by aezell on 08-31-2007 01:06 PM

ClaiborneClaiborne

You can access reports via the web (but not the API), but it is not pretty.

First, you need the internal ID for your report. You can find this when the report is displayed.

Then, you need to create a session in your application by logging in with a valid user name/password.

Once you have the session Id in your application, you can use CURL calls to retrieve the report as a CSV file.

For more details, go to this posting  -

http://sfdc-heretic.warped-minds.com/2006/04/10/progmatic-access-to-salesforcecom-reports/

 

pfarrellpfarrell
I'd like to open this thread again.

Is it still true that you can't access reports programmatically. 

The original thread was about accessing reports through the API.  I want to look up reports via a soql/sosl query.  Is this possible?

ClaiborneClaiborne

As far as I know, there is no way to query the list of reports for a specific report name.

CAVEAT - None of the below is based on the public API, so it is subject to change without notice at any time.

There is a function that returns the list of all public reports as an XML string. Once the string is returned, you would have to process the string on your own to find the specific report or reports that you want.

To see how the function works, start a salesforce.com session. At the home page, your link will be

https://na3.salesforce.com/home/home.jsp (note that na3 may change for your specific organization).

Type in a new link as

https://na3.salesforce.com/servlet/servlet.ReportList (this is case-sensitive) to return the list of reports.

Also, working programmatically, you could create a salesforce.com session. Once you have the location (which determines the specific server - na1, na2, etc.) and the session id, this link will return the xml file.

https://<location>.salesforce.com/servlet/servlet.ReportList?sessionId=<sessionId>

aezellaezell
David,
This post made me laugh. I just spent a good chunk of time trying to figure out how to send the session ID as a cookie in my request (in python). Then, you come along and show me that I can just shove onto the querystring in the URL.

Too funny.

I did learn something about Python though, so it wasn't completely lost.

Thanks for lightening my code considerably :)

Alex
pfarrellpfarrell
Thanks for the comments David.  I've been able to get the reports via the means you described. 

I will probably end up using your method in my project, but I wanted to clarify my original requirements, in case anyone has any ideas.

I am creating an S-Control to act as a manager for some custom objects.  I am using the salesforce ajax libraries to perform crud operations on my objects.  These custom object's data is eventually pushed to an outside system (using Salesforce SOA).  One of the pieces of data I want to pass are ids for reports that are tied to records in my custom object.

Right now, I would like to code a droplist interface for selecting custom reports.  I had wanted to get a list of report names and ids using SOQL (i.e. just running a query to retrieve this data).

If anyone knows how I can get at this data without having to do an ajax call to get the report list and then parse it, I'd be most appreciative.