Update
Partial update of a deal
POST https://do.workzeal.com/deal/update
Only the fields you pass are changed; everything else in the deal stays as it was. This way you can, for example, move a deal to another stage by passing only id and status_id.
Request Body
| Name | Type | Description |
|---|---|---|
| deal* | JSON |
200: OK Standard response object
{
"status": "success",
"error": "",
"code": null,
"rows": 0,
"pages": 0,
"page": 0,
"value": "1"
}
JSON
All available parameters
- id - * Deal code
- name - Deal name
- company_id - Client code
- type_id - Deal type code
- status_id - Deal status (stage) code
- user_id - Code of the person responsible for the deal
- contact_id - Contact person code
- sum - Deal amount
- date_start - Start date
- date_finish - End date
- note - Deal note (replaces the old one)
- tags - Comma-separated tags (replace the old ones)
{
"id": 12345,
"status_id": 6,
"sum": 250000
}
Note
Required parameter: only id (deal code) plus at least one field to update.
Partial update specifics: numeric fields with the value 0 are treated as "not passed", so the amount cannot be reset to zero, while note and tags, when passed, completely replace the old value.
Example
cURL
PHP
NodeJS (Request)
curl --location --request POST 'https://do.workzeal.com/deal/update' \
--header 'Authorization: Bearer XXXX-XXXXXXX-XXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 12345,
"status_id": 6,
"sum": 250000
}
'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://do.workzeal.com/deal/update',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"id": 12345,
"status_id": 6,
"sum": 250000
}
',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer XXXXX-XXXXXXX-XXXXXXXXX',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://do.workzeal.com/deal/update',
'headers': {
'Authorization': 'Bearer XXXX-XXXXXXX-XXXXXXX',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"id": 12345,
"status_id": 6,
"sum": 250000
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Directories
Response
{
"status": "success",
"error": "",
"code": null,
"rows": 0,
"pages": 0,
"page": 0,
"value": "1"
}
// value: 1 - the deal has been updated, 0 - error (the text is in the error field)
Previous
Next