Sample Flows
This article presents some sample use cases your service might support. You are not limited to these exact flows, but they can serve as good starting points to help you plan your external database integration.
Query real-estate properties in an external database
Note: This sample flow requires the implementation of at least the basic functionality endpoints of this service plugin.
A real-estate agency stores information about the properties it manages in an external database. The agency has a Wix site and wants to make its properties available to its visitors. The agency implements the relevant endpoints of the External Database Service Plugin and hosts them at the https://www.<example-domain>.com
base URL. It then creates a Wix app, configures it with the details of the service, and installs the app on its site. The site can then interact with the external database like this:
-
On a dedicated search page, a site visitor searches for relevant properties with the following search and sorting criteria:
- Locality: Springfield
- Max number of rooms: 3
- Price range: $550-$700
- Sort: Low-to-high
- Page limit: 3
-
Based on the visitor's criteria, Wix Data automatically sends a Query Data Items request to the service endpoint hosted at
https://www.<example-domain>.com/v3/items/query
. The request body looks like this:Copy1 -
The endpoint responds with the relevant items, filtered and sorted as specified in the query. For example:
Copy1The site receives the data as if it were stored in a native Wix Data collection. It then parses the response and displays the results to the visitor.
Manage local job positions with an app
Note: This sample flow requires the implementation of the following service plugin endpoints:
A large employment agency maintains its job listings in an external database. The agency has several branches. Each branch operates in a different area and has its own Wix site.
To enable each branch to independently access and manage the job listings stored in the database, the agency implements the External Database service plugin and hosts it on the https://www.<example-domain>.com
base URL. It then creates a private app and configures it with the details of the service. Each branch installs the app on its site to gain independent access to the database. Site visitors can then query, sort, and filter relevant listings on the site branch most relevant to them.
In this flow, a site visitor searches for open kitchen staff positions on a branch's site. After finding a relevant position, they browse for other listings by the same employer. Once filled, the branch closes the position.
-
On a dedicated search page, a site visitor searches for open listings using the following search and sorting criteria:
- Locality: North Utah
- Sector: Restaurants
- Position: Kitchen Staff
- Show listing details: Job Title, Employer, Address, Hourly Salary
- Sort: New-to-old
- Page limit: 5
-
Based on these preferences, Wix Data automatically sends a Query Data Items request to the service endpoint hosted at
https://www.<example-domain>.com/v3/items/query
. The request body looks like this:Copy1The endpoint responds with the relevant listings, filtered and sorted as specified in the query. For example:
Copy1 -
The site receives the data as if it were stored in a native Wix Data collection. It then parses the response and displays the results to the visitor.
-
One of the listings retrieved by Wix Data is for a position offered by Hell's Kitchen. The visitor wants to check which other positions Hell's Kitchen offers. To do that, Wix Data sends a Query Referenced Data Items request to the service endpoint hosted at
https://www.<example-domain>.com/v3/items/query-referenced
. For each position listed by this employer, the visitor is interested in the job title, work address, hourly salary, and position status. The request looks like this:Copy1The endpoint responds with all the job positions offered by Hell's Kitchen, filtered and sorted as specified in the query. For example:
Copy1 -
The site receives the data as if it were stored in a native Wix Data collection. It parses the data, filters for positions whose
status
isOPEN
, and displays the results to the visitor. -
The Hell's Kitchen branch on Old Nick Road hires a new employee for the kitchen staff position. The employment agency's branch then closes the position. To do that, Wix Data sends an Update Data Items request to the service endpoint hosted at
https://www.<example-domain>.com/v3/items/update
to update the position's status asHIRED
. The request looks like this:Copy1The endpoint responds with the updated item:
Copy1