--- tags: aiida, restapi, aiidalab --- # AiiDA REST API enhancement list based on AiiDAlab testing Currently, only general endpoints (nodes, processes, etc.) are available. The user needs to write a query function (with a filter) to get node data. Based on the test using AiiDAlab, it would be helpful if there is a client library to get the common data. There is also a discussion on the client library. https://github.com/aiidateam/aiida-restapi/issues/59 ## Read node data In AiiDA, there are utils functions in `orm`. It would be helpful to have similar functions in the client library. - load_node --> api_load_node - load_code --> api_load_code - load_computer --> api_load_computer ### Read incoming and outgoing nodes Get outputs of a ProcessNode using AiiDA is easy. ``` process.outputs ``` Using REST API, we need to query the `outgoing`: ```python query function($process_pk: Int) { node(id: $process_pk) { outgoing { rows { node { uuid attributes } link { label } } } } } ``` Note, the `CALL` is also included. We need to exclude this. It would be helpful to have similar functions in the client library. - process.inputs --> api_load_node_inputs - process.outputs --> api_load_node_outputs - process.called --> api_load_node_called ### Read other attributes Some attributes are available in the AiiDA node, but not straightforward in the API, e.g. ```python # in AiiDA node.is_finished ``` Use API, one can check ```python "exit_status" in node["attributes"] ``` It would be helpful to have the documentation to show this in the client library. ### Add general query for advanced user Support pass any query to the request. ```python= def api_get_node(query: dict) -> dict[str, t.Any]: """""" results = request("graphql", {"query": query}) return results["data"]["nodes"] ``` For example, I want to query all `QeAppWorkChain` processes. ```python= query = { nodes(filters: "process_type ILIKE '%QeAppWorkChain%'") { count rows{ uuid id ctime } } } api_get_node(query) ``` ### PUT method Currently, no `PUT` method available to processes. We need `PUT` method to update the `extra` parameters of a `ProcessNode`. ```python process.base.extras.set("builder_parameters", parameters) ```