Skip to main content

Changes API and WebHooks

Changes API - How to Implement WebHooks

Written by Petr Pech

Changes API lets you read only what has changed since your last request — instead of repeatedly downloading entire records. Web Hooks can notify you of the same changes by calling your address.


Activating Changes API

You can check the status with a query; turning it on and off is done with the PUT method:

Address

Method

Meaning

/c/{firma}/changes/status.xml

GET

Returns Changelog is enabled. or Changelog is disabled.

/c/{firma}/changes/enable

PUT

Turns on change tracking.

/c/{firma}/changes/disable

PUT

Turns off change tracking.

/c/{firma}/changes/control

GET

The same control is available in the web interface.

⚠️ Turning it on or off affects database triggers, so no users may be logged in to the license at the time — otherwise the action will fail with an error. This is described in more detail in the article Cannot enable Changes API.


Reading changes

GET /c/{firma}/changes.xml

The response carries globalVersion in its root element — the number to use as the starting point for your next request. Each record then shows what happened to it:

<winstrom globalVersion="143902">
<cenik in-version="1" operation="update" timestamp="2019-01-01 00:00:00.0">
<id>170</id>
<id>code:DEVET</id>
</cenik>
</winstrom>


Web Hooks

Registering and listing hooks is done at the /c/{firma}/hooks address:

PUT /c/{firma}/hooks.xml?url=http://muj.server.cz/hook.php&format=XML

GET /c/{firma}/hooks.xml

ℹ️ Web Hooks must be enabled on the server side. If they are not enabled, every request to /hooks will respond with the 400 error and the message Hooks are not enabled in flexibee-server.xml — in the cloud, ask support to enable it; on a self-hosted installation, it's a server setting.


Related

Did this answer your question?