The eLead REST Service Version 2 (available in Release v34.0 and higher) is a continuation upon the ELead Rest Service, the key difference being that version 2 can accept the eLead data from either the query string or a JSON body. If both are submitted, the service used the JSON body.
See also: Dev0 Fall 2021 Release Notes
- Login as the Administrator
- Go to Setup | Develop | Sites
- If there are no Sites listed, you will have to choose a domain. If there is already a site set up, skip to Step 8.
- As a best practice, use your full company name as a run on word. For example, 'Image Landscaping' becomes 'imagelandscaping'.
- Double check the spelling because you can't undo this once you click 'Register'!
- Accept the terms and click 'Register My Force.com Domain'.
- Now that the domain is set up, click 'New' in the 'Sites' area. If a domain was already set up then you will start here.
- Leave the 'Type of new Site' as 'Guest' and click Continue.
- Fill in the form with the following values:
- Site Label: PublicSite (This can be anything really.)
- Site Name: PublicSite
- Active Site Home Page : InMaintenance (This can be anything really.)
- Leave all other fields blank
- Click Save
- Activate the site, if not active.
- Click the link under the Site Label column
- On the Site Details screen, click Public Access Settings
- Scroll down to 'Enabled Apex Class Access' and click Edit
- Under 'Available Apex Classes' select i360.eLeadRESTVersion2 and click Add
- Click Save
Your endpoint URI will be https://domainname.secure.force.com/services/apexrest/i360/eLeadv2. Replace domainname with the domain you picked in step 3. It can also be found in the Site's detail page.
The eLead REST Service Version 2 validates fields in the following ways:
- At least one of the following:
Also note that if the customer wants to skip this validation process, it can be disabled by going to Public System Settings and disabling the "eLead Required Field Validation" setting (for first name and last name validation) and/or disabling the "eLead Contact Method Validation" setting (for email/address/phone validation).
Do a POST to the /services/apexrest/i360/eLeadv2 endpoint using the eLead fields to populate as query parameters.
Example JSON Body
"i360__Address_1__c":"21838 Ivy Road",
- If an eLead is successfully created, the response status will read
Successand the response code will be
201 Created. The fields of the new lead will also be returned in the response.
- If the creation fails, the response status will read
errorwith a response code of
400 Bad Requestand the response will include a description of the error.
- In both cases, the request body will also be returned in the response.