How to Configure OData Endpoint in Advanced Mode
An OData endpoint can be created using the +NEW menu, as any other object. With Skyvia’s OData Endpoint Wizard, you can create an OData endpoint for your data source in just a few simple steps:
- Select Advanced mode to design the endpoint model.
- Select a connection to your data source.
- Define the endpoint model — select the data to publish, optionally adjust OData entities and associations between them.
- Configure endpoint security settings.
- Specify the endpoint name and some other settings and click the Create button.
After you select the endpoint creation mode, the OData Endpoint Wizard page opens. On the first wizard step, you need to select a connection or create a new one to publish data from.
Selecting Data to Publish
On the second wizard step, you need to define which data to publish via the endpoint. The way you define it depends on the mode, selected on the first step.
In the Advanced mode, the left part of the wizard page displays data source tables/objects, and the right part displays the diagram with objects added to endpoint. OData entities on the diagram are presented as rounded rectangle shapes on the diagram, which consist of a header, a list of entity fields, and a list of navigation properties. Properties that are an entity key, have a key icon on the left.
To add an object to endpoint, simply drag it from the list to the diagram. When you drag a table to the diagram, Skyvia automatically creates the corresponding entity set and entity type. Skyvia also automatically creates relationships (associations) with other entity types on the diagram, corresponding to tables, with which there are relationships in the data source. If a table references itself in the data source, Skyvia creates a self-referencing association on the diagram.
By default, Skyvia exposes all the table fields via the OData protocol. However, you can double-click entities on the diagram and tweak them in more details, if necessary.
Associations can be added to the endpoint only in the Advanced mode. When dragging tables to an endpoint diagram, Skyvia automatically generates the corresponding OData entities and relationships (associations) between them, based on the data source metadata. They are displayed as dark blue lines on the diagram. Skyvia even supports self-referencing relationships, when an entity references itself.
For each relation, a navigation property is generated on each side of the relation. Navigation property names are either generated from a foreign key or foreign key field name in the data source, if possible, or simply from the related entity name. These names are then used in OData request URLs when selecting entities by relations.
If necessary, you can edit or delete the generated relationships or even create your own custom ones.
To edit an association, in an entity on any end of the association click Edit Association. The Edit Association dialog box opens.
In this dialog box you can set Names for the corresponding navigation properties on both ends of the association. If needed, you can also select entity columns, on which the association is built, and specify the relation Cardinality — One to Many, One to One, One or Zero to One.
Adding Custom Associations
In addition to associations, automatically generated based on data source metadata, Skyvia allows adding custom associations to OData endpoints.
To add a custom association, find the plus icon at the bottom of the entity that should become the parent in the new association. Drag this icon to the entity, that should become the child in this association. This opens the Edit Association dialog box.
In this dialog box, select the association Cardinality, specify the Names of the corresponding navigation properties, and select the data source Columns, based on which the association will be built.
Please note that in case of custom or modified relationships, you should care about the relation integrity of the data in your data source yourself.
Endpoint Settings: Security, OData Version, Write Access
On the third wizard step, you can change endpoint security settings. Namely, you can add user accounts with passwords to make your endpoint data available only for authenticated users. Additionally, you can allow access to your endpoint only for specific IP addresses. Check Security Settings for more information.
After this, click the Next step button on the bottom of the page. The last wizard step allows you to specify the new endpoint name and configure additional settings: default OData protocol version and endpoint access mode.
The following OData versions are available:
- oData Last — the latest supported version is used. Currently this is OData v4.
- oData v4 — OData v4 is used. It uses JSON format for returned data and metadata.
- oData v1-v3 — OData v3 (backward compatible with OData v1) is used. By default, it uses ATOM format for returned data and metadata.
Please note that regardless of the selected version, Skyvia creates both OData v1-v3 and OData v4 endpoints, which are available by adding odata3/ or odata4/ to the result endpoint URL. The selected version is just a default version, available via base endpoint URL without adding version to it.
By default, Skyvia creates an endpoint with read/write access to data. Of course data can be actually written via this endpoint only if the underlying data source allows writing into the corresponding tables/objects. You can optionally forbid writing to an endpoint by clicking the Read Only button.