Skip to content

Instantly share code, notes, and snippets.

@mattparlane
Created March 2, 2016 19:25
Show Gist options
  • Save mattparlane/6c329d27c887a630db9a to your computer and use it in GitHub Desktop.
Save mattparlane/6c329d27c887a630db9a to your computer and use it in GitHub Desktop.
<?php
$token = '<token>';
$c = curl_init("https://api.pipedrive.com/v1/organizations?api_token={$token}");
curl_setopt_array($c, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => 'name=Matt %26 Co',
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($c), true);
$orgId = $result['data']['id'];
echo $orgId, "\n";
$c = curl_init("https://api.pipedrive.com/v1/organizations/{$orgId}?api_token={$token}");
curl_setopt_array($c, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => "id={$orgId}&name=Marco %26 Co",
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($c), true);
var_dump($result);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment