I've gone through Salesforce Analytics Rest Api and implemented an apex class which will make rest call
and get report data of a given report id, but my requirement is to retrieve the report data which is visible to a particular user, for that i am passing below url to get the data but getting all the data. services/data/v32.0/analytics/reports/<reportId>?includeDetails=true&ownerId=005xxxxxxxxxxxx

Please help me out.


What you have doesn't work. The methods of the API run in the context of the current user (logged-in user). The methods have access to whatever the current user has access to.

You can filter the report to show only those rows where the ownerId equals a value that you specify if need be by specifying a report filter in the post body of the request.

Also, you should consider using the Analytics API via Apex since you are already using Apex. There are corresponding methods to run the reports and filter (see the docs in the Developer's Guide). The reports are still run as the current logged in user, though.

  • Even though if i use Analytics API , it'll display the records based on current logged-in user, In those records only i can able to filter the report by passing ownerId, right? – College Management Dec 12 '14 at 13:42
  • That is correct. – Peter Knolle Dec 13 '14 at 12:33
  • Sure. You are welcome. – Peter Knolle Dec 16 '14 at 1:52
  • Is this affected by "without sharing"? -- ie. would calling the Analytics API via Apex run with current user's context, or system user's context? – Benj Feb 10 '15 at 15:41

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.