CodeIgniter Forums

Full Version: Salesforce.com REST API Library v1.0
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

[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?

El Forum

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

El Forum

[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?