0
votes

I'm trying to run a Salesforce custom report with runtime filters, as described on the page at https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/sforce_analytics_rest_api_filter_reportdata.htm#example_requestbody_execute_resource

However, whenever I run the report (async) with a handcrafted JSON block, the result report ignores the filters and brings back the full result set. The filters are also not listed in the reportMetadata block in the response.

I'm posting to the URL: https://SALESFORCEINSTANCE/services/data/v31.0/analytics/reports/00Oo0000004aH7R/instances?includeDetails=true

The JSON for the body of my POST request: { "reportMetadata": { "name": "All Contacts", "id": "00Oo0000004aH7R", "reportFormat": "TABULAR", "reportBooleanFilter": "1 AND 2", "reportFilters": [
{ "value": "[email protected]", "column": "EMAIL", "operator": "notEqual"}, { "value": "[email protected]", "column": "EMAIL", "operator": "notEqual"} ], "detailColumns": [ "CONTACT_ID", "FIRST_NAME", "LAST_NAME", "ADDRESS2_STREET", "ADDRESS2_CITY", "ADDRESS2_STATE", "ADDRESS2_ZIP", "ADDRESS2_COUNTRY", "PHONE1", "EMAIL" ],

"developerName" => "All_Contacts",

"reportType" =>  {
  "label" =>  "Contacts & Accounts",
  "type" =>  "ContactList"
}
    "currency": null,
    "aggregates": [       ],
    "sortBy": "CONTACT_ID"     

}

1

1 Answers

1
votes

Found the answer: the Content-Type header must be set to 'application/json', else Salesforce will ignore the body of your request.