How to make a CRUD of Leads from Salesforce.com

https://{instance} – {sandbox}.my.salesforce.com/services/oauth2/token

I need to get the token using client_id, client secret, username, password of salesforce.

At the wordpress, I would use the curl using those informations.

Once I get a token, I can create/update Lead.

https://{instance} – {sandbox}.my.salesforce.com/services/data/v54.0/sobjects/lead

It has Get, Post, Patch …

For Patch, curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, ‘PATCH’);

sample code

$ch = curl_init();

curl_setopt( $ch, CURLOPT_URL, $salesforce_url);

curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode(data) );

curl_setopt( $ch, CURLOPT_HTTPHEADER,[

‘Content-type: application/json’,

‘Content-Length: ‘ . strlen(json_encode(data)),

‘Authorization: Bearer’ . $auth_token]);

curl_setopt( $ch, CURLOPT_RETURNTRANSER, true);

If you need more details, please click on here.

https://github.com/sod-21/salesforce-connection

Leave a Reply

Your email address will not be published.