How to query the attributes of a node from nodejs?

Hello,

I have created a graph with GraphStudio (using the user interface).

I would like to access the graph via API from a program that I have made in nodejs (outside of GraphStudio)

I need to access the graph from my nodejs program to query the attributes of the nodes.

How can I query the attributes of a node from a nodejs program outside of GraphStudio?

Thank you very much to all

a greeting

Hi @javipc,

you will need a JavaScript connector (https://github.com/TigerGraph-OSS/Tigroid.js) and use the RESTAPI interface to query and fetch the data:
https://docs.tigergraph.com/dev/restpp-api/intro#gsql-server-requests
https://docs.tigergraph.com/dev/restpp-api/built-in-endpoints#authentication

Maybe @matija.zorkovic could add some more tips & tricks ?

Best,
Bruno

@Bruno, I think that you write everything what is important for start.

Tigroid JS is not ideal regards to async calls and compatibility with typescript, but nothing major that can’t be easily fixed.

1 Like

Hello,

Thank you very much for your responses.

I have two questions about them:

1: Do you have an example to follow / see? That is, a nodejs program that connects to a graph made with GrapsStudio.

I am not a programmer but with an example I could do it. I need a base code to do it. Could it be please?

I just need to know how to query the value of an attribute of a node in a Graph.

2: Is it possible to do the query synchronously? My software is synchronous and I need the query of the attribute of a node of the graph to be synchronous

Thank you

OK, please check our JS connector:

And the sample app using it:

Bruno

@javipc
They now have a tutorial on how to go about this:

It’s pretty useful and only took me about an hour to setup. Setting up the graph and relationships took a bit of time.

@Bruno You can send this article the next time someone asks for Nodejs examples :slight_smile:

2 Likes

Thank you, @rohitb1vs10! :tiger: