To edit an existing deal, send a PUT http request as shown in the example below. Whenever you make an edit with the API, the complete newly changed record will be returned to you in JSON format.

// Snapforce API token
$api_token = 'api token goes here';

// Snapforce company domain
$api_user = 'username goes here';

// Pass field name, value pairs for data payload
$data = array(
    'name' => '20 widget deal',
    'amount' => '2,500'
);
  
// The Deal ID
$deal_id = 366;
  
// Endpoint URL for updating a deal
$url = 'https://app.snapforce.com/prodigy/api/v1/request.php?module=deals&deal_id=' . $deal_id . '&api_token=' . $api_token . '&api_user=' . $api_user;


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));

echo 'Sending request...' . PHP_EOL;

$output = curl_exec($ch);
curl_close($ch);

// Convert the JSON to a deal object
$result = json_decode($output, true);

// Print the results
print_r($output);