You need to sign in to do that
Don't have an account?

report api and excel
Hello everyone,
I am very new to API and writing my first API ever. I am trying to extract data from a report and put it in a formatted excel file. It is giving me an error.
Apex class
Error:
Line: 11, Column: 1
System.CalloutException: no protocol: /services/data/v45.0/analytics/reports/00OG00000046KbV
I understand that the endpoint is coming as blank. I looked at the REST API and Reports & Dashoard guide. I cannot find a way to fix this. Is it because of authorization?
Any suggestion would be appreciated!
Thanks!
I am very new to API and writing my first API ever. I am trying to extract data from a report and put it in a formatted excel file. It is giving me an error.
Apex class
public class excelReport { public excelReport(){ Http http = new http(); HttpRequest request = new HttpRequest(); string sessionId = System.UserInfo.getSessionId(); request.setEndpoint('/services/data/v45.0/analytics/reports/00OG00000046KbV'); request.setMethod('GET'); request.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId()); request.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); HttpResponse response = http.send(request); if(response.getStatusCode() == 200){ System.debug(response.getBody()); } } }
Error:
Line: 11, Column: 1
System.CalloutException: no protocol: /services/data/v45.0/analytics/reports/00OG00000046KbV
I understand that the endpoint is coming as blank. I looked at the REST API and Reports & Dashoard guide. I cannot find a way to fix this. Is it because of authorization?
Any suggestion would be appreciated!
Thanks!
You have ://<http:YOUT INSTANCENAME> ?<REST API >.
use
Use this code
Make sure you set the remote site settings
All Answers
You have ://<http:YOUT INSTANCENAME> ?<REST API >.
use
Use this code
Make sure you set the remote site settings
I added https://myInstance.saleforce.com in the remote setting. Same url as the endpoint. Is that correct?
Read the body and try to save it to the files or attachements
Do like this
like
How would I achieve this?
Thanks alot for helping out!
In this document, they explain it as simple as changing the accept in the header to be able to download the report which I realised that it is not a complete information
So some web app to downlaod the files