In this walkthrough, we’ll create an API that unifies data from two distinct sources.
Watch Video Tutorial : Combining Multiple Data Sources
Here we have,
- Car details (make, model, year, standard price) from a PostgreSQL database (via Supabase)
- Weekly discount values from a CSV file
When a manufacturing year is provided as a GET parameter, the API will return the inventory for that year, including the final discounted price calculated as:
Final Price = Standard Price – Discount
Step 1: Connect Your Data Sources
After logging in, go to the Data Sources tab. Confirm that:
- The PostgreSQL database is connected
- The CSV file is uploaded or connected via FTP
If either is missing, connect them before proceeding to ensure all data is available for integration.
Step 2: Create a Multi-Source API
Navigate to the APIs tab, click New API, choose Multi DataSource, and click OK.
At this stage, you can:
- Add individual queries using the Add Query button, or
- Use natural language input, allowing Silverline’s AI assistant to interpret your request
For example, input:
“Give me details of the cars such as make, model, price, etc., along with their discounts. Where year as {{year}}“
Silverline will automatically:
- Analyze your data sources
- Identify relevant tables and columns
- Suggest data mappings for your review and confirmation
- Generate the queries needed to retrieve and join data across sources
Step 3: Link Data Across Sources
When multiple sources are involved, Silverline intelligently joins queries using a special format:{{QueryID:<ID>:<colname>}}
This format ensures that key columns (e.g., IDs) from one query can be passed into another, enabling seamless data integration.
Note: If you’re adding queries manually, be sure to use this format to link them properly.
Step 4: Test and Modify Queries
Once the queries are generated:
- Run each one independently to verify results
- A green checkmark confirms successful execution
- Use the edit (pen) icon to refine individual queries if needed
When satisfied, give your API a name — for example, “Discounted Prices”.
Step 5: Combine Queries in a Script
Go to the Script tab. Silverline automatically merges the results using an object called {{queryResultset}}
, making it easy to process and structure the unified response.
Need changes? You can:
- Use natural language (e.g., “Add a finalPrice field = price – discount”), or
- Manually update the Python script
Silverline updates the script accordingly. The sample data shown here is from your query preview. Full API results can be viewed in the API Endpoint tab (note: subject to a 1500-row limit).
Step 6: Save, Configure, and Publish
Once the output looks good:
- Save and publish the API
- Set access controls under the API Access Control tab
- Assign a friendly endpoint name via Optional Settings
Your unified, multi-source API is now ready to use!