Back

Creating Your Own Data Connector


New Data Connectors are created with an initial code template to connect to a REST web service.

The template:

  • Adds the Data Connector to the connectors.dataconnectors JavaScript API, using its name.
  • Loads the Data Connector's Data Connector Configuration from the Verj.io Runtime Environment, using its name.
  • Initialises a Verj.io REST Data Connector object, passing in the base URI for the web service from the loaded Configuration.
  • Provides an example function that performs a GET on the web service.

The Verj.io REST Data Connector, restDataConnector, is the core component of a Data Connector and performs the communication with the web service by providing get(), put(), post(), delete(), patch() and head() functions.

Extending the Data Connector

A Data Connector is extended by adding functions to it that use restDataConnector to interact with one or more endpoints on the web service.

Any number of functions can be created in a Data Connector. It is useful to consider the actions your application may want to perform against the web service and combine several calls to the web service in one function.

Request headers, including authentication headers, can be configured in the restDataConnector, as can error handling functions.

Once a Data Connector is added to a Form (see Using a Data Connector), any server event from that Form, its Pages and their Controls can use your functions.