Brian
Brian3w ago

Access table outside of BuildShip

How can I do a simple GET request on a rowy table outside of Buildship? Basically what the "Get Document" node is doing, but as a Rest API fetch Request.
3 Replies
AI Support
AI Support3w ago
AI Support Bot Information
<@112676328783802368> you can react on the relevant answer (message) with a ✅ in this thread when you think it has been solved, by the bot or by a human! Anyone can react on this message with a ❌ if the GPT bot is unhelpful or hallucinating answers. Please note: Team members will review and answer the questions on best efforts basis.
AI Support
AI Support3w ago
AI Response
To perform a simple GET request on a Rowy table outside of Buildship, similar to what the "Get Document" function does, you can create a REST API endpoint that fetches data from the database. Here is a general approach you can follow to achieve this using a typical fetch request: 1. Set up a Server Endpoint: You need to have a server endpoint that can handle HTTP GET requests. This server will interact with your database. 2. Fetch Data from the Database: The server endpoint should fetch data from your Rowy table based on the specified conditions. This can be done using an appropriate database query. 3. Return Data as JSON: Once you have fetched the data from the database, convert it to a JSON format and return it as the response to the GET request. Here's a basic example of how you might implement the GET request using JavaScript and Node.js with Express:
const express = require('express');
const app = express();
const port = 3000; // or your preferred port

// Mock function to get document from database
const getDocumentFromDatabase = (documentId) => {
// Replace with actual database fetching logic
return { id: documentId, name: "Example Document" };
};

app.get('/get-document', (req, res) => {
const documentId = req.query.id; // Assume the document ID is passed as a query parameter
if (documentId) {
const document = getDocumentFromDatabase(documentId);
res.json(document);
} else {
res.status(400).send('Document ID is required');
}
});

app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
});
const express = require('express');
const app = express();
const port = 3000; // or your preferred port

// Mock function to get document from database
const getDocumentFromDatabase = (documentId) => {
// Replace with actual database fetching logic
return { id: documentId, name: "Example Document" };
};

app.get('/get-document', (req, res) => {
const documentId = req.query.id; // Assume the document ID is passed as a query parameter
if (documentId) {
const document = getDocumentFromDatabase(documentId);
res.json(document);
} else {
res.status(400).send('Document ID is required');
}
});

app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
});
Explanation: - Server Setup: Set up a simple server using Express.js to handle requests. - GET Endpoint: Create a /get-document endpoint that responds to GET requests. - Query Parameter: Accept a documentId as a query parameter to identify which document to fetch. - Database Interaction: Replace the mock function with actual logic to interact with your Rowy table. - Send Response: Send the fetched document data back as a JSON response. Make sure to replace the mock database logic with actual code for fetching data from your Rowy table, possibly using a library or SDK that interfaces with your database. This setup is outside the specific functionalities provided by Buildship's nodes, and it involves programming a server-side script. If you need further integration details, consider referring to the Rowy documentation or support.
BuildShip AI Support
Brian
BrianOP3w ago
I need to know what the actual GET request looks like. I can't find anything in the rowy docs. Also asked the question in the in-app support now : #553670