简体   繁体   中英

Filters ignored with Salesforce Reporting REST API?

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": "selma.husser@cox.net", "column": "EMAIL", "operator": "notEqual"}, { "value": "aonofrio@onofrio.com", "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"     

}

找到答案:必须将 Content-Type 标头设置为“application/json”,否则 Salesforce 将忽略您的请求正文。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM