fluree / server

Fluree Server - Operates Fluree in consensus, fault-tolerant, redundant
12 stars 1 forks source link

Feature/import api #88

Open bplatz opened 1 month ago

bplatz commented 1 month ago

This adds a new 'import' API to fluree/server which accepts TURTLE (.ttl) and JSON-LD.

The main feature of this is that raw RDF data can be imported without converting it to JSON-LD... and even raw JSON-LD can be imported without having to reformat it by wrapping your JSON-LD file in {"insert": }.

The RDF data is just sent in the HTTP body, regardless of format.

API endpoint:

<server>/fluree/import

To use the new API with TURTLE, the HTTP Headers must include:

{"Content-Type":  "text/turtle",
 "Fluree-Ledger": "<fluree-ledger-name-here>"}

To use the API with JSON-LD, the HTTP Headers must include:

{"Content-Type":  "application/json",
 "Fluree-Ledger": "<fluree-ledger-name-here>"}

For now, the ledger must already exist, and you are just 'importing' into an existing ledger. Having the ability to create a new ledger from an import is likely desirable, and it can be added fairly simply.