You need to sign in to do that
Don't have an account?
Analytics API from Apex
Hello,
I am using Analytics API to retrieve a report and I want to use a existing report and change the filter, I am using this code to get the describe of the report:
HttpRequest req = new HttpRequest(); req.setEndpoint('https://na8.salesforce.com/services/data/v29.0/analytics/reports/REPORT_ID/describe'); req.setMethod('GET'); req.setHeader('Authorization', 'OAuth MY_ACCESS_TOKEN'); Http http = new Http(); HTTPResponse res = http.send(req); String responseDescribe = res.getBody();
This return the right describe, but my problem is when I change the filter and send in POST to retrieve the data of report with the new filter:
HttpRequest req2 = new HttpRequest(); req2.setEndpoint('https://na8.salesforce.com/services/data/v29.0/analytics/reports/REPORT_ID'); req2.setMethod('POST'); req2.setHeader('Authorization', 'OAuth MY_ACCESS_TOKEN'); //change the old value of parameter to the new value req2.setBody(responseDescribe.replace('Account 1', 'Account 2')); Http http2 = new Http(); HTTPResponse res2 = http2.send(req2); String responseDescribe2 = res2.getBody();
My responseDescribe2 have the data with the old filter, but when I execute in POST with the same result of reponseDescribe in workbench.developerforce.com this response works.
There is missing any parameter to send in my POST?
How can I change this filter to the new value and use in my apex class?
I need to include the Account Name in my filter.
Thanks.
I solved my problem.
I just include one more parameter in my call: