import Tractorbeam from 'tractorbeam';
const client = new Tractorbeam({
apiToken: process.env['TRACTORBEAM_API_TOKEN'], // This is the default and can be omitted
});
async function main() {
const response = await client.graphs.addTuples('graph-owner', 'graph-name', {
tuples: [{ object: 'Company1', predicate: 'worksAt', subject: 'Person1' }],
});
console.log(response.inserted);
}
main();
Copy
{
"inserted": 10
}
Graphs
Insert Graph Tuples
Insert tuples into an existing graph.
POST
/
graphs
/
{owner}
/
{name}
/
tuples
JavaScript
Copy
import Tractorbeam from 'tractorbeam';
const client = new Tractorbeam({
apiToken: process.env['TRACTORBEAM_API_TOKEN'], // This is the default and can be omitted
});
async function main() {
const response = await client.graphs.addTuples('graph-owner', 'graph-name', {
tuples: [{ object: 'Company1', predicate: 'worksAt', subject: 'Person1' }],
});
console.log(response.inserted);
}
main();