Get providers for a flow
This method returns the processes that produce a given product (as output) or provide the treatment of a given waste flow (as input). Thus, the flow parameter of this method needs to be a product or waste flow (or an ID of that flow). The returned providers can be linked to respective product inputs or waste outputs of other processes in a product system.
Rest API | GET /data/providers/{flow-id} |
JSON-RPC | data/get/providers |
Python IPC | Client.get_providers |
Return type: | List[TechFlow] |
Examples
Python IPC
import olca_ipc as ipc
import olca_schema as o
client = ipc.Client()
providers = client.get_providers(
flow=o.Ref(id="7f6bb533-2d3c-43a6-ac60-6eef299d7c52")
)
for p in providers:
print(p)
# TechFlow(
# provider=Ref(id='71dab7ae-4d58-4f73-8449-5967c296bcde', ...
# flow=Ref(id='7f6bb533-2d3c-43a6-ac60-6eef299d7c52', ...
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/providers",
params: {
// only the ID is required here
"@type": "Flow",
"@id": "66c93e71-f32b-4591-901c-55395db5c132",
name: "electricity, high voltage"
}
})
});
let v = await resp.json();
console.log(v);
// {
// jsonrpc: "2.0",
// result: [
// {
// provider: {
// "@type": "Process",
// "@id": "ba98a130-d92c-4c40-8fe9-c8cab5b956ab",
// name: "electricity production, wind, 1-3MW turbine, onshore",
// processType: "LCI_RESULT",
// flowType: "PRODUCT_FLOW"
// },