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
vinod kumar 164vinod kumar 164 

Sample code for fetching Asynchronous report call using HtpWebRequest (Rest Api)


We are new to the salesforce and we are trying to integrate our App to salesforce.
Right now we are trying to fetch the particular reports data from salesforce using HttpWebrequest(Rest Api) using c# code.
we are implementing asynchronous report call with post request body to get the data but we are unable to get and it is throwing exception that is
[{"message":"The request body is either invalid or incomplete.","errorCode":"JSON_PARSER_ERROR"}]

So please provide us with sample code for fetching the reports with asynchronous call and also tell us how to send post request body for asynchronous report call  for fetching reports data.

Daniel BallingerDaniel Ballinger
What code do you currently have? There is likely something wrong with the JSON body that you are POSTing.

There is a good example of the raw HTTP calls required in Example of an asynchronous report run (

I know with my other REST API class from .NET it is important to write the JSON form data to the request stream correctly and to specify the ContentLength. What does your JSON for the POST body look like?
Aaron MelgarAaron Melgar
payload = {"reportFormat": "TABULAR"}
r ="{sf_url}/services/data/v47.0/analytics/reports/{report_id}/instances", json=payload)

I get the same error with the above code. Per the docs I can add the reportFormat setting in my payload but get this error:
[{"message":"The request body is either invalid or incomplete.","errorCode":"JSON_PARSER_ERROR"}]