API Webhooks


Integration with third party systems is possible using the ResourceSpace API. A developer can write scripts to use the API of both systems to synchronise data offline.

This plugin augments this by allowing those remote scripts to be called from within ResourceSpace, allowing for users to drive the timing of the synchronisation between the two systems.


Enable API Webhooks in the Plugin Manager. The plugin has an example configuration in its config folder. This should be copied to your master include/config.php file and edited as appropriate.

An example for two buttons:

    "buttontext"=>"Fetch object data from CMS",
    "buttontext"=>"Push image to CMS",

The "location" attribute only supports "edit" (for the metadata edit page) at this stage but could support further locations in additional iterations. In the case of the edit page, the resource ID is appended to the URL automatically when fetched.

A second property "buttontext" allows custom label text which can optionally use the i18n syntax for multilingual support.

API Webhooks

This button is displayed to the user on the resource edit page in the bottom bar with the existing "Save" button, right aligned with the configured label text. When pressed, the configured URL is accessed (from the ResourceSpace server, not from the browser) via a POST request. Any updated information on the resource form is saved prior to the POST request ensuring any new data entered by the user is used.


As an example, ResourceSpace integrates with a third party Collections Management System. A field contains the remote CMS ID. The user can enter a value in this field and a button labelled "Fetch object data from CMS" is configured as above. Clicking this button calls a third party script that:

  1. Uses the ResourceSpace API to fetch the just-entered CMS ID using the provided ResourceSpace resource ID
  2. Uses the CMS API to fetch metadata as appropriate
  3. Uses the ResourceSpace API to update the ResourceSpace resource record with the fetched CMS metadata
  4. The user then sees the page reload with the CMS data now populated into appropriate fields.

Many other scenarios are possible e.g. pushing data/images to the remote system in the other direction.