Get all data sets of a given type
Returns all data sets of a given type from a database. This is not a practical method for all types of data sets and may is not available in a specific context. For example, it is fine to get all unit groups but a server would go down when you query for all processes in a large database. Typically, you just want to query all descriptors of a data set type.
Rest API | GET /data/{type}/all |
JSON-RPC | data/get/all |
Python IPC | Client.get_all |
Return type: | List[E > RootEntity] |
Examples
Python IPC
import olca_ipc as ipc
import olca_schema as o
client = ipc.Client()
for group in client.get_all(o.UnitGroup):
print(group.name)
# Units of area
# Units of energy
# Units of length
# Units of mass
# ...
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/all",
params: {
"@type": "UnitGroup"
}
})
});
let v = await resp.json();
console.log(v);
// {
// jsonrpc: "2.0",
// result: [
// {
// "@type": "UnitGroup",
// "@id": "838aaa21-0117-11db-92e3-0800200c9a66",
// name: "Units of mass*length",
// category: "Technical unit groups",
// version: "00.00.000",
// defaultFlowProperty: {