cookbook/ REST & Curl Snippets
Last Updated: October 20, 2018Raw REST API calls using curl and other tools.
REST API Cookbook
Direct interaction with the TigerGraph REST++ and GSQL servers.
1. Authentication
Creating a Secret
bashterminalcurl -X POST \ -u tigergraph:password \ "https://YOUR_HOST:9000/gsqlserver/gsql/secrets?graph=MyGraph"
Requesting a Token
bashterminalcurl -X POST \ "https://YOUR_HOST:9000/gsqlserver/gsql/tokens" \ -d '{"secret": "YOUR_SECRET_HERE"}'
2. Vertex & Edge Operations
Getting a Single Vertex
bashterminalcurl -X GET \ -H "Authorization: Bearer YOUR_TOKEN" \ "https://YOUR_HOST:9000/graph/MyGraph/vertices/User/user_1"
Deleting an Edge
bashterminalcurl -X DELETE \ -H "Authorization: Bearer YOUR_TOKEN" \ "https://YOUR_HOST:9000/graph/MyGraph/edges/User/user_1/FOLLOWS/User/user_2"
3. Querying
Executing a Query (POST)
bashterminal# Using POST to send parameters in JSON curl -X POST \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{"u": "user_1"}' \ "https://YOUR_HOST:9000/graph/MyGraph/query/follower_count"
Running Built-in Statistics
bashterminal# Get system health and component status curl -X GET \ -H "Authorization: Bearer YOUR_TOKEN" \ "https://YOUR_HOST:9000/admin/status"
4. Metadata & System
List All Graphs
bashterminalcurl -X GET \ -H "Authorization: Bearer YOUR_TOKEN" \ "https://YOUR_HOST:9000/gsqlserver/gsql/graphs"
[!CAUTION] Avoid including plaintext passwords in your curl commands. Use environment variables or
.netrcfiles for better security.
On this page
- REST API Cookbook
- 1. Authentication
- Creating a Secret
- Requesting a Token
- 2. Vertex & Edge Operations
- Getting a Single Vertex
- Deleting an Edge
- 3. Querying
- Executing a Query (POST)
- Using POST to send parameters in JSON
- Running Built-in Statistics
- Get system health and component status
- 4. Metadata & System
- List All Graphs
TigerGraph Book
v1.0 Curated