Update

Partial update of a document

POST https://do.workzeal.com/document/update

Only the fields you pass are changed; everything else in the document stays as it was.

Request Body

Name Type Description
document* JSON
{
  "status": "success",
  "error": "",
  "code": null,
  "rows": 0,
  "pages": 0,
  "page": 0,
  "value": "1"
}

JSON

All available parameters
  • id - * Document code
  • number - Document number (requires type_id at the same time)
  • sum - Document amount
  • date - Document date
  • note - Note (replaces the old one)
  • status_id - Document flag/status code
  • type_id - Document type code
  • deal_id - Deal code
  • contact_id - Contact person code
  • user_id - Responsible person code
  • date_expire - Expiration date
  • tags - Comma-separated tags (replace the old ones)

{
   "id": 91234,
   "sum": 175000,
   "note": "Invoice revised: delivery added"
}

Note

Required parameter: only id (document code) plus at least one field to update.

When changing the number, be sure to pass type_id as well; the number is checked for uniqueness within the document type. 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 --location --request POST 'https://do.workzeal.com/document/update' \
--header 'Authorization: Bearer XXXX-XXXXXXX-XXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": 91234,
    "sum": 175000
  }
  '
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://do.workzeal.com/document/update',
  'headers': {
    'Authorization': 'Bearer XXXX-XXXXXXX-XXXXXXX',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "id": 91234,
    "sum": 175000
  })
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Response

{
  "status": "success",
  "error": "",
  "code": null,
  "rows": 0,
  "pages": 0,
  "page": 0,
  "value": "1"
}
// value: 1 - the document has been updated, 0 - error (the text is in the error field)
Previous