PHP code example of apideck-libraries / php-sdk

1. Go to this page and download the library: Download apideck-libraries/php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

apideck-libraries / php-sdk example snippets




// Declare Unify Api to use
$crmApi = $apideck->getCrmApi();

// Override consumerId serviceId as declared in initial configuration for this operation.
$serviceId = 'salesforce';
$response = $crmApi->contactsAll(
  false,
  null,
  null,
  $serviceId,
  null,
  10
);


Apideck\Client\Apideck;
use Apideck\Client\ApideckConfiguration;
use Apideck\Client\Model\Contact;
use Apideck\Client\Model\Address;
use Apideck\Client\Model\PhoneNumber;

$config = new ApideckConfiguration('<insert-api-key-here>', '<insert-application-id-here>', '<insert-consumer-id-here>');
$apideck = new Apideck($config);

$crmApi = $apideck->getCrmApi();

$response = $crmApi->contactsAll(false, null, null, $serviceId, null, 10);

$data = $response->getData();
$result = $crmApi->contactsUpdate([
  $data[0]->getId(),
  new Contact([
    "name" => "John Doe",
    "first_name" => "John",
    "last_name" => "Doe",
    "addresses" => [
      new Address([
        "city" => "Hoboken",
        "line1" => "Streetname 19",
        "state" => "NY"
      ])
    ],
    "phone_numbers" => [
      new PhoneNumber([
        "number" => "0486565656",
        "phoneType" => "home"
      ])
    ]
  ])
]);

var_dump($result);

 Apideck\Client\Apideck;
use Apideck\Client\ApideckConfiguration;

$config = new ApideckConfiguration('<insert-api-key-here>', '<insert-application-id-here>', '<insert-consumer-id-here>');
$apideck = new Apideck($config);