【问题标题】:Unable to create listview using metadata api on Salesforce无法在 Salesforce 上使用元数据 api 创建列表视图
【发布时间】:2021-06-09 17:52:38
【问题描述】:

我是 Salesforce 元数据 API 的新手。我想使用元数据 api 在 Salesforce 上创建联系人列表视图。

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:met="http://soap.sforce.com/2006/04/metadata">
   <soap:Header>
      <met:AllOrNoneHeader>
         <met:allOrNone>false</met:allOrNone>
      </met:AllOrNoneHeader>
      <met:CallOptions>
         <met:client>https://xyz.salesforce.com</met:client>
      </met:CallOptions>
      <met:SessionHeader>
         <met:sessionId>xyz</met:sessionId>
      </met:SessionHeader>
   </soap:Header>
   <soap:Body>
      <met:createMetadata>
         <!--Zero or more repetitions:-->
         <met:metadata>
            <!--Optional:-->
            <met:fullName>TESTVIEW__c</met:fullName>
         </met:metadata>
      </met:createMetadata>
   </soap:Body>
</soap:Envelope>

我得到了

[
    {
        "errorCode": "METHOD_NOT_ALLOWED",
        "message": "HTTP Method 'POST' not allowed. Allowed are HEAD,GET"
    }
]

我使用的端点是:

https://xyz.salesforce.com/services/data/v51.0/sobjects/Contact/listviews

我更新到 SOAP 端点:

https://xyz-dev-ed.my.salesforce.com/services/Soap/m/51.0/1112312DRED21

现在我得到了

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Client</faultcode>
            <faultstring>content-type of the request should be text/xml</faultstring>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

我想我更近了一步。有效载荷对创建联系人列表视图有效吗?

【问题讨论】:

    标签: soap salesforce salesforce-lightning


    【解决方案1】:

    您无法通过对 REST API 端点进行 POST 来进行元数据 API 部署。

    如果您想使用 REST 端点,请使用 REST deployRequest endpoint。如果您想使用您的有效负载似乎面向的 SOAP createMetadata() 调用,则需要使用 SOAP API

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-15
      • 1970-01-01
      • 2017-07-26
      相关资源
      最近更新 更多