Delete a data set

Deletes the specified data set from the database. This method is not available when the server runs in read-only mode.

Rest APIDELETE /data/{type}/{id}
JSON-RPCdata/delete
Python/IPCClient.delete
Return type:Ref

Examples

Python IPC

import olca_ipc as ipc
import olca_schema as o

client = ipc.Client()
ref = client.delete(
    o.Ref(ref_type=o.RefType.Source, id="16cba9b2-2987-4735-9f3e-96fedf8449dd")
)
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/delete",
      params: {
        "@type": "Source",
        "@id": "91bbc461-4ce1-4f83-b95d-de0909575174",
      }
    })
  });
  let v = await resp.json();
  console.log(v);
  // {
  //   jsonrpc: "2.0",
  //   result: {
  //     "@type": "Source",
  //     "@id": "91bbc461-4ce1-4f83-b95d-de0909575174",