cookbook/ REST & Curl Snippets
Last Updated: October 20, 2018

Raw 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

bashterminal
curl -X POST \ -u tigergraph:password \ "https://YOUR_HOST:9000/gsqlserver/gsql/secrets?graph=MyGraph"

Requesting a Token

bashterminal
curl -X POST \ "https://YOUR_HOST:9000/gsqlserver/gsql/tokens" \ -d '{"secret": "YOUR_SECRET_HERE"}'

2. Vertex & Edge Operations

Getting a Single Vertex

bashterminal
curl -X GET \ -H "Authorization: Bearer YOUR_TOKEN" \ "https://YOUR_HOST:9000/graph/MyGraph/vertices/User/user_1"

Deleting an Edge

bashterminal
curl -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

bashterminal
curl -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 .netrc files for better security.