Insert or update a data set

Inserts or updates a provided data set in the database. This method is not available when a server runs in read-only mode.

Rest APIPUT /data/{type}
JSON-RPCdata/put
Python/IPCclient.put
Request bodyE > RootEntity
Return type:Ref

Examples

Python IPC

import olca_ipc as ipc
import olca_schema as o

client = ipc.Client()
ref = client.put(o.Source(name="Inter-process communication with openLCA"))
print(ref)
# Ref(
#  id="16cba9b2-2987-4735-9f3e-96fedf8449dd",
#  name="Inter-process communication with openLCA",
# ...

JSON-RPC via Fetch API

The example below shows the usage of this method using the JSON-RPC protocol via the Fetch API which is available in modern web-browsers or platforms like Deno.

  let resp = await fetch("http://localhost:8080", {
    method: "POST",
    body: JSON.stringify({
      jsonrpc: "2.0",
      id: 1,
      method: "data/put",
      params: {
        "@type": "Source",
        "@id": "91bbc461-4ce1-4f83-b95d-de0909575174",
        "name": "Inter-process communication with openLCA",
        // ...
      }
    })
  });
  let v = await resp.json();
  console.log(v);
  // {
  //   jsonrpc: "2.0",
  //   id: 1,
  //   result: {
  //     "@type": "Source",
  //     "@id": "91bbc461-4ce1-4f83-b95d-de0909575174",
  //     name: "Inter-process communication with openLCA"
  //   }
  // }