Log In Using the SOAP API
The Bulk API doesn't provide a login operation, so you must use SOAP API to log in.
- Create a text file called login.txt containing the following text:
01<?xmlversion="1.0"encoding="utf-8"?>02<env:Envelopexmlns:xsd="http://www.w3.org/2001/XMLSchema"03xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"04xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">05<env:Body>06<n1:loginxmlns:n1="urn:partner.soap.sforce.com">07<n1:username>your_username</n1:username>08<n1:password>your_password</n1:password>09</n1:login>10</env:Body>11</env:Envelope> - Replace your_username and your_password with your Salesforce user name and password.
- Using a command-line window, execute the following cURL command:
1curl https://login.salesforce.com/services/Soap/u/48.0 -H "Content-Type: text/xml; charset=UTF-8" -H "SOAPAction: login" -d @login.txtThe Soap/u/ portion of the URI specifies the partner WSDL. You can use Soap/c/ to specify the enterprise WSDL.
- Salesforce returns an XML response that includes <sessionId> and <serverUrl> elements. Note the values of the <sessionId> element and the first part of the host name (instance), such as yourInstance-api, from the <serverUrl> element. Use these values in subsequent requests to the Bulk API.