Ian Piper
Ian Piper

Reputation: 95

GraphDB API: question about import method

I am using GraphDB 10.8 (Free), and want to use the GraphDB API to import an RDF file into the default graph. I have been reading and trying out the API documentation, but I'm failing to run the import POST method. The error seems to be the file name of the import file. I initially used the /rest/repositories/importtest/import/server GET method to show the files available for import, and that works nicely. It gives a JSON package of information that I then used to build the import POST method, but no matter what I've tried for the filenames array property, I get the error:

File [path]/briefdata.rdf does not exist

To be clear, the file does exist, at /home/ianpiper/graphdb-import (which is the default location on the server) and it is world read-write. Actually, the file is found with the GET form of the method, so it seems like in the POST method I am just not providing the right form of the path leading to the file. Can anyone set me straight on this?

Thanks,

Ian.

Upvotes: 0

Views: 59

Answers (2)

Sava Savov
Sava Savov

Reputation: 611

Access the Swagger UI for the Data Import REST API:

In the GraphDB Workbench, navigate to Help > REST API. This will open the Swagger UI, which documents all available endpoints, including those for importing server files into a repository.

GraphDB Swagger

The method that you'll need in this case is the POST one.

Click "Try It Out," provide the required data, and the generated CURL request will guide you in the right direction.

Upvotes: 0

Ian Piper
Ian Piper

Reputation: 95

The answer to this was not to use a path at all, but simply to put the filename into the fileNames array:

     "fileNames": [
    "briefdata.rdf"
  ]

It makes sense I suppose; GraphDB has the import folder /home/ianpiper/graphdb-import already defined, so it only needs the filename.

Upvotes: 2

Related Questions