Step 2: Retrieval of plugin definition

Once registered, Bókun will then immediately make the first call to the plugin API to retrieve the plugin definition.

gRPC service interface

rpc GetDefinition (io.bokun.inventory.common.api.grpc.Empty) returns (PluginDefinition) {}

REST URL

GET /plugin/definition

Request object

gRPC Empty object is just a placeholder and contains no fields.

REST object issues a GET request without any parameters.

Response object

The above call requires plugin to respond with PluginDefinition object which has the following attributes:

Attribute
Mandatory
Notes
name
Plugin name. Must identify (e.g. can contain your company name or the name of the company who had implemented the plugin) to distinguish it from the other plugins
description
Plugin description
capabilities
Supported flags: • SUPPORTS_RESERVATIONS - if plugin sets this flag, booking process will be a two-step process: both CreateReservation and ConfirmBooking methods will be called. Otherwise if the flag is unset, only CreateAndConfirmBooking method will be called. It is recommended to implement two-step booking even if external system does not support two-step booking: in this case, do booking parameters validation in first step and the actual booking in the second. • SUPPORTS_AVAILABILITY - if plugin sets this flag, Bokun will call the plugin to check availabilities for products. If this flag is unset, Bokun will not call the plugin for availability info but will refer to availability info in Bokun database (as if the product was not external). • SUPPORTS_RESERVATION_CANCELLATION - if enabled, it means that a plugin is able (and required) to respond to cancelReservation requests coming from Bokun. This option can only be enabled if SUPPORTS_RESERVATIONS is enabled (requests to cancelReservation will only be sent if both flags are present). It is otherwise assumed that the external system is expiring reservations automatically after certain time period. • SUPPORTS_AMENDMENT - If enabled, it means that a plugin is able (and required) to respond to amendBooking requests coming from Bokun. Currently unsupported (ignored) flags: • SUPPORTS_PRICING
parameters
Should return a non-empty list of parameters for configuring this plugin. Configuration is done per each vendor and therefore is likely to contain entries such as username, password, URL endpoint (referring to production or UAT environment for external API) and so on. Each parameter should have a unique name.

Below is a sample screen in Bókun UI generated by such list of parameters:

Notion image
 

Once plugin responds with the definition and Bókun administrator registers the plugin, the vendor is then able to proceed with configuring it using given parameters.

Other usages of getDefinition

On top of normal usage, Bókun uses getDefinition call for plugin monitoring purposes as this call is not expected of putting any significant burden on the plugin infrastructure.

 
 
Did this answer your question?
😞
😐
🤩