CodeIgniter Forums
Salesforce.com REST API Library v1.0 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Salesforce.com REST API Library v1.0 (/showthread.php?tid=49860)



Salesforce.com REST API Library v1.0 - El Forum - 03-05-2012

[eluser]Peter Guest[/eluser]
Overview
A Codeigniter library to interact with the Salesforce.com REST API. The library currently has 3 methods for interacting with Salesforce.com.

Methods
Code:
$this->salesforce->get_record();
$this->salesforce->get_query();
$this->salesforce->update_record();

Configuration
Code:
var $instance_url = '<insert your $instance_url here>';
var $api_version = 'v24.0';
var $client_id  = '<insert your $client_id here>';
var $client_secret = '<insert your $client_secret here>';

var $username  = '<insert your $username here>';
var $password  = '<insert your $password here>';
var $security_token = '<insert your $security_token here>';

Example Usage

:: get_record ::
Code:
$fields = array('Id','Name','Account.Id');
$results = $this->salesforce->get_record('opportunity','0062000000MjkRo', $fields);

:: get_query ::
Code:
$results = $this->salesforce->get_query(
     "SELECT Id,
     Account.Name,
     CloseDate,
     CurrencyIsoCode,
     Account.BillingPostalCode,
     Account.BillingStreet,
     Account.BillingState,
     Account.BillingCity,
     Account.BillingCountry,
     Renewal_Confirmation__c,
     StageName,
     Amount,
     (SELECT Id, Description, PricebookEntry.Name, Licenced_Product__r.Id, Quantity, UnitPrice, ListPrice, TotalPrice FROM OpportunityLineItems WHERE Do_Not_Renew__c != true ORDER BY Description ASC)
     FROM Opportunity WHERE Id='0062000000MjkRo'");

:: update_record ::
Code:
$data = array('Change_Details__c'=>$this->input->post('request_info'),
              'Renewal_Confirmation__c'=>"Change Requested");
$this->salesforce->update_record('opportunity', '0062000000MjkRo', $data);

Download
salesforce_v1.0.zip


Salesforce.com REST API Library v1.0 - El Forum - 08-25-2012

[eluser]keithmancuso[/eluser]
I was excited when i saw this post as i am trying to build a custom salesforce.com integration right now... but sadly i see the link is broken..

woudl love to get access to the code if your still working on it?


Salesforce.com REST API Library v1.0 - El Forum - 08-25-2012

[eluser]Peter Guest[/eluser]
Apologies, here is the new link: http://www.peterguest.co.za/wp-content/uploads/2012/04/Salesforce_v1.1.zip


Salesforce.com REST API Library v1.0 - El Forum - 11-20-2012

[eluser]Unknown[/eluser]
I am not sure why but when I add this library, and config the configuration file. Codeigniter throws a generic "Malformed array" error and will not run after. Anyone experience this?