Creating a Custom API
Synngular allows users to create custom APIs tailored to their specific needs. This guide will help you understand how to write and configure custom API code.
Open the Custom API Section
- Navigate to the APIs tab in your Synngular dashboard.
- Click on the Create API button.
Define API Details
- Enter API Name – Choose a meaningful name for your API.
- Provide a Description – Briefly describe what your API will do.
- Select Method Type – Choose Custom from API Type section.
Writing Custom API Code
- You can write your custom API logic using JavaScript.
- Use the built-in code editor to add your custom logic.
Example Custom API Code (Node.js/Express Style):
module.exports = async (req, res) => {
try {
const { param1, param2 } = req.body;
// Custom Logic Here
const result = `Processed: ${param1}, ${param2}`;
return res.status(200).json({ success: true, data: result });
} catch (error) {
return res.status(500).json({ success: false, error: error.message });
}
};Configure API Settings
- Authentication – Choose whether your API requires authentication.
- Data Store Integration – Connect your API with a database if needed.
Save and Deploy
- Click Save to store your custom API.
- Click Deploy to make the API live.
Once deployed, you can test your API using the built-in testing tools in Synngular or external tools like Postman.
By following these steps, you can successfully create and manage a custom API in Synngular.
Last updated on