This article presents sample use cases and corresponding flows that demonstrate how to use the Wix Data APIs together. These can be a helpful starting point as you plan your implementation.
You can use multiple Data APIs to create a fully configured job board system. This flow creates collections with proper schemas, adds indexes for query optimization, and populates the collections with initial data.
To set up a job board:
Call Create Data Collection to create a companies collection. Include the following properties in your request:
In the fields array, include fields with these recommended values for type:
name, slug, and location: TEXTdescription: RICH_TEXTlogo: IMAGEwebsite: URL
Set the values in permissions as follows:
read: ANYONE so visitors can view the listings.insert, update, and remove: ADMIN so only site owners can manage content.
Call Create Data Collection to create a jobs collection. Include the following properties in your request:
In the fields array, include fields with these recommended values for type:
title, slug, and location, employmentType, status: TEXTdescription: RICH_TEXTsalaryMin and salaryMax: NUMBERpostedDate and deadline: DATETIME
Also include the following fields to add a cross reference for the companies collection created earlier.
company: with type set to MULTI_REFERENCE and typeMetadata.multireference.referencedCollectionId set to companies.
Set permissions to control the collection's access as follows:
read: ANYONE so visitors can view the companies' details.insert, update, and remove: ADMIN so only site owners can manage content.
Call Create Index to create an index on the jobs collection for the status and postedDate fields to accelerate queries for open jobs sorted by date.
Call Create Index to create an index on location to accelerate location-based job searches.
Call Bulk Insert Data Items to populate the companies collection with company profiles.
Call Bulk Insert Data Items to populate the jobs collection with job listings, referencing the company IDs from the previous step.
You can extend an existing collection's schema and migrate data to populate the new fields. This is useful when evolving your data model over time.
To add fields and migrate data:
jobs collection schema and revision number.jobs collection to add a new remote field with type set to BOOLEAN.remote value based on the location field. For example, set to true if location contains "Remote".remote field if you plan to filter by it frequently.You can create a backup of your collections before making significant changes, then restore the data if needed. This is useful for protecting against accidental data loss during migrations or bulk updates.
To back up and restore data:
backupId.backupId from step 1.You can combine querying and aggregation to build rich job search features. This flow retrieves jobs with their company details and calculates hiring statistics.
To query and aggregate job data:
dataCollectionId set to jobs:
query.filter, set status to "open" and location to the target city.query.sort, sort by postedDate in descending order to show newest jobs first.includeReferencedItems to ["company"] to include full company details in the response.groupingFields to ["location"].itemCount (total jobs per location) and average on salaryMax (average maximum salary).status equals "open" to display the total number of open positions.