Get descriptors
This function is useful for exploring the content of a database. It returns a list of data set descriptors for a given data set type. A descriptor contains just a few information, like the name or category path, to understand the content of a data set. Descriptors are valid data set references; they can be used to reference a data set in a given context (e.g. referencing a process as calculation target in a calculation setup).
Rest API | GET /data/{type} |
JSON-RPC | data/get/descriptors |
Python/IPC | Client.get_descriptors |
Return type | List[Ref] |
Examples
Python IPC
import olca_ipc as ipc
import olca_schema as o
client = ipc.Client()
refs = client.get_descriptors(o.FlowProperty)
for ref in refs:
print(ref.name)
# Area
# Area*time
# Duration
# Energy
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/get/descriptors",
params: {
"@type": "FlowProperty"
}
})
});
let descriptors = await resp.json();
console.log(descriptors);
// {
// jsonrpc: "2.0",
// id: 1,
// result: [
// {
// "@type": "FlowProperty",
// "@id": "838aaa20-0117-11db-92e3-0800200c9a66",
// name: "Goods transport (mass*distance)",
// category: "Technical flow properties",
// refUnit: "t*km"
// },