6

如何使用 REST API 访问 Salesforce 日历信息。日历信息是指所有任务、会议等。是否有任何 Rest API 可用于使用 Javascript/Java 访问 Salesforce 日历...在此先感谢...

4

2 回答 2

0

当然,您必须先登录:

  • POST https://login.salesforce.com/services/Soap/c/login_url和:
    • login_url从 Setup>Generate Enterprise WSDL> Generate,寻找<soap:address location=
    • security_token从个人资料>设置>Reset My Security Token
    • 标题Content-Type=text/xml&SOAPAction=""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
  <soapenv:Body>
    <urn:login>
      <urn:username>your_login</urn:username>
      <urn:password>concatenate_password_and_security_token</urn:password>
    </urn:login>
  </soapenv:Body>
</soapenv:Envelope>

然后您可以进行任何 SQL 查询,例如针对Task对象:

  • POST https://serverrl和:
    • server_url&session_Token来自登录 xml 响应
    • 标题Content-Type=text/xml&SOAPAction=""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:SessionHeader>
         <urn:sessionId>session_Token</urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
    <urn:query>
        <urn:queryString>
            SELECT Subject, Type, Status, WhoId FROM Task WHERE WhoId != NULL
        </urn:queryString>
    </urn:query>
   </soapenv:Body>
</soapenv:Envelope>

示例响应:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
    <soapenv:Header>
        <LimitInfoHeader>
            <limitInfo>
                <current>123</current>
                <limit>1234</limit>
                <type>API REQUESTS</type>
            </limitInfo>
        </LimitInfoHeader>
    </soapenv:Header>
    <soapenv:Body>
        <queryResponse>
            <result>
                <done>true</done>
                <queryLocator xsi:nil="true"/>
                <records xsi:type="sf:Task">
                    <sf:Status>Completed</sf:Status>
                    <sf:Subject>Email: xxx    [ ref:xxx:ref ]</sf:Subject>
                    <sf:WhoId>0034Hxxx</sf:WhoId>
                </records>
                <records xsi:type="sf:Task">
                    <sf:Status>Not Started</sf:Status>
                    <sf:Subject>Email: xxx    [ ref:xxx:ref ]</sf:Subject>
                    <sf:WhoId>0034Ixxx</sf:WhoId>
                </records>
                <size>37</size>
            </result>
        </queryResponse>
    </soapenv:Body>
</soapenv:Envelope>

来源https://blog.floriancourgey.com/2020/10/salesforce-soap-api-external-call

于 2021-08-18T13:51:40.327 回答
0

这是 REST API 指南的链接,它描述了您如何使用 REST API: http: //www.salesforce.com/us/developer/docs/api_rest/

这里是 Salesforce 标准对象的链接以及您可以通过 API 对每个对象执行的操作:http: //www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_list.htm

于 2020-07-08T20:18:31.730 回答