Inputting JSON data programmatically via virtual graphs

I am writing in Python and using the requests package to get/parse JSON data from a REST API. I have mapping file(s) for that data but how do I programmatically invoke a virtual import? It seems that the Virtual Graph interfaces are geared to online stores vs inputting CSVs and JSON.

Thanks.
Andrea

The REST endpoint is http://localhost:5820/admin/virtual_graphs/import. The request type in multipart form. The parts have names "database" for the DB name, "input_file_type", which should be "JSON", and "input_file" for the JSON content. Here is a CURL example.

-Paul

stardog $ curl -v -u admin:admin -F "database=example" -F "mappings=<virtual/test/resources/json/bw_binding.sms" -F "input_file_type=JSON" -F "input_file=<virtual/test/resources/json/bw_binding.json" http://localhost:5820/admin/virtual_graphs/import
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 5820 (#0)
* Server auth using Basic with user 'admin'
> POST /admin/virtual_graphs/import HTTP/1.1
> Host: localhost:5820
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 1361
> Content-Type: multipart/form-data; boundary=------------------------d0dcecd92caafe86
> Expect: 100-continue
> 
* Done waiting for 100-continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Length: 0
< Date: Mon, 06 Apr 2020 12:45:48 GMT
< 
* Connection #0 to host localhost left intact
* Closing connection 0
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.