Skip to content

Instantly share code, notes, and snippets.

View sugarknowledge's full-sized avatar

Knowledge Manager sugarknowledge

View GitHub Profile
@sugarknowledge
sugarknowledge / REST_PHP_set_entry.php
Created June 26, 2012 23:29
PHP Example using cURL with the v4 REST API to create an account using set_entry
<?php
$url = "http://{site_url}/service/v4/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();
@sugarknowledge
sugarknowledge / REST_PHP_login_example.php
Created June 27, 2012 00:39
PHP Example using cURL with the v4 REST API to login and retrieve a session id
<?php
$url = "http://{site_url}/service/v4/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();
@sugarknowledge
sugarknowledge / REST_PHP_get_module_fields_example.php
Created June 27, 2012 02:30
PHP Example using cURL with the v4 REST API to retrieve fields under a module with get_module_fields
<?php
$url = "http://{site_url}/service/v4/rest.php";
$username = "admin";
$password = "password";
function call($method, $parameters, $url)
{
ob_start();
$curl_request = curl_init();
@sugarknowledge
sugarknowledge / REST_PHP_get_entries_example.php
Created June 27, 2012 03:24
PHP Example using cURL with the v4 REST API to retrieve account records with get_entries
<?php
$url = "http://{site_url}/service/v4/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();
@sugarknowledge
sugarknowledge / SOAP_CSharp_login_example.cs
Created June 27, 2012 04:51
C# Example using SOAP to retrieve a session id
using System;
using System.Text;
using System.Security.Cryptography;
namespace SugarSoap
{
class Program
{
static void Main(string[] args)
{
@sugarknowledge
sugarknowledge / REST_PHP_get_entry_list_example.php
Created June 28, 2012 03:16
PHP Example using cURL with the v4 REST API to retrieve contacts and related email addresses with get_entry_list
<?php
$url = "http://{site_url}/service/v4/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();
@sugarknowledge
sugarknowledge / REST_PHP_get_relationships_example.php
Created June 28, 2012 03:49
PHP Example using cURL with the v4 REST API to retrieve leads related to a specific target list with get_relationships
<?php
$url = "http://{site_url}/service/v4/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();
@sugarknowledge
sugarknowledge / SOAP_PHP_login_example.php
Created June 28, 2012 15:24
PHP Example using NuSOAP with the v4 SOAP API to login and retrieve a session id
<?php
$username = "admin";
$password = "password";
$url = "http://{site_url}/service/v4/soap.php?wsdl";
//require NuSOAP
require_once("./nusoap/lib/nusoap.php");
//retrieve WSDL
@sugarknowledge
sugarknowledge / SOAP_PHP_get_entry_list_example.php
Created June 28, 2012 19:27
PHP Example using NuSOAP with the v4 SOAP API to retrieve a list of records with get_entry_list
<?php
$url = "http://{site_url}/service/v4/soap.php?wsdl";
$username = "admin";
$password = "password";
//require NuSOAP
require_once("./nusoap/lib/nusoap.php");
//retrieve WSDL
@sugarknowledge
sugarknowledge / REST_PHP_get_entry_list_example.php
Created June 28, 2012 19:42
PHP Example using cURL with the v4 SOAP API to retrieve a list of records with get_entry_list
<?php
$url = "http://{site_url}/service/v4/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();