Hi,
In this curl command -d part is missing.
it’s will not respond any, because API will expect -d [data part] part in the curl command, try to pass loading job and file location in -d parts in curl command.
Below approaches worked for me,
consider loading job
use graph MyGraph
CREATE LOADING JOB loadData {
// this below info we going to pass in runtime.
//DEFINE FILENAME student = $my_gs_datasource_1:gs://folder_1/folder_2/student.csv;
DEFINE FILENAME student ;
LOAD student TO VERTEX v1 VALUES (...)USING SEPARATOR = ",";
}
Approach 1
curl -H ‘Content-Type: application/json’ -u “<tigergraph_user>:” -X POST ‘http://localhost:14240/gsql/v1/loading-jobs/run?graph=MyGraph’
-d ‘[
{
“name”: “loadData”,
“sys.data_root”: “/tmp”,
“verbose”: true,
“dryrun”: true,
“interval”: 1,
“maxNumError”: 1,
“maxPercentError”: 1,
“dataSources”: [
{
//remove this comment line while running, ex:$my_gs_datasource_1:gs://folder_1/folder_2/student.csv
“filename”: “student”,
“path”: “gs://folder_1/folder_2”,
“name”: “my_gs_datasource_1”
}
]
}
]’
Tip : Try to use Git Bash command line. Windows CMD line also works, but Bash CMD will be more compatible.
Approach 2 - pass JSON info in separate json file.
if it’s complex to pass in -d[data part] in curl, we can put this info in JSON, we can refer those file in curl,
following comment.
curl -H ‘Content-Type: application/json’ -u “<tigergraph_user>:” -X POST ‘http://localhost:14240/gsql/v1/loading-jobs/run?graph=MyGraph’ -d “@D:\my_loading_job_info.json”
this file script looks likes below, without ’ ’ character literal
[
{
“name”: “loadData”,
“sys.data_root”: “/tmp”,
“verbose”: true,
“dryrun”: true,
“interval”: 1,
“maxNumError”: 1,
“maxPercentError”: 1,
“dataSources”: [
{
“filename”: “student”,
“path”: “gs://folder_1/folder_2”,
“name”: “my_gs_datasource_1”
}
]
}
]
TG docs: [GSQL Endpoints run loading job]
As I understand it, the REST API follows basic validation before running, including data parts, even when given at the loading job level.
Sharing my experience - please ignore if anything is wrong!