无法使用Salesforce上的元数据api创建列表视图



我是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>

I am getting

[
{
"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>

我想我离成功又近了一步。有效负载是否对联系人列表视图的创建有效?

不能通过POST到REST API端点来部署元数据API。

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

最新更新