使用 Salesforce Reporting REST API 忽略过滤器?

Filters ignored with Salesforce Reporting REST API?

我正在尝试 运行 使用 运行 时间过滤器的 Salesforce 自定义报告,如 https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/sforce_analytics_rest_api_filter_reportdata.htm#example_requestbody_execute_resource

页面所述

但是,每当我 运行 使用手工制作的 JSON 块报告(异步)时,结果报告会忽略过滤器并返回完整的结果集。过滤器也未在响应的 reportMetadata 块中列出。

我要发帖到 URL: https://SALESFORCEINSTANCE/services/data/v31.0/analytics/reports/00Oo0000004aH7R/instances?includeDetails=true

我的 POST 请求正文的 JSON: { "reportMetadata":{ "name": "All Contacts", "id": "00Oo0000004aH7R", "reportFormat": "TABULAR", "reportBooleanFilter": "1 和 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 header 必须设置为 'application/json',否则 Salesforce 将忽略您请求的 body。