【问题标题】:How to add the CallOptions header using the salesforce REST API in PHP如何在 PHP 中使用 salesforce REST API 添加 CallOptions 标头
【发布时间】:2017-06-12 14:34:34
【问题描述】:

我正在使用 REST api 将数据从我的 wordpress 网站同步到 salesforce。 我希望在报告中查看 api 调用的来源,我发现我可以在“CallOptions”标头中使用客户端 ID。

我的参考:https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_calloptions.html

来自该页面:

Field name
    Sforce-Call-Options

Field values
    client—A string that identifies a client.
    defaultNamespace—A string that identifies a developer ...

我的问题是,我如何编写 headers 数组(正确的语法)以包含只有“client”和值的看涨期权标头。

我试过'headers' => array('Sforce-Call-Options' => 'My-Client-Name') 但客户 ID 未显示在报告中。 另外,因为这是 REST,我可能需要在 salesforce 环境中做些什么吗?我设法在 SOAP 中添加了这个(使用“setCallOptions”方法)

【问题讨论】:

  • 您找到解决方案了吗?我也有同样的问题。
  • 很遗憾没有。

标签: php rest http-headers salesforce


【解决方案1】:

“Sforce-Call-Options”标头是一个逗号分隔的字符串,其中字符串中的每一项都是由等号分隔的键值对。

Sforce-Call-Options: client=SampleCaseSensitiveToken/100, defaultNamespace=battle

如果你是用 PHP 做的,那么你可以参考之前的这篇文章。Salesforce callout using PHP

【讨论】:

  • 在'headers'数组中我试过:'Sforce-Call-Options' => 'client=Shop-Sync'和'Sforce-Call-Options:client=Shop-Sync'都没有' t 工作(我没有在报告中看到客户名称)我可能需要在 salesforce 内部添加什么来使用这个标题?
  • @RealGigex 我在报告中遇到了同样的问题,我没有看到客户名称
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-20
  • 2019-05-02
  • 1970-01-01
  • 2016-10-05
  • 2020-10-02
  • 2021-08-20
相关资源
最近更新 更多