Is there a way to update the state of a running Jupyter Lab server instance

We are adding custom environment variables to Jupyter Lab containers that are spawned by Jupyterhub’s KubeSpawner. We are doing this to store stateful information that a user’s Jupyterlab needs to for accessing internal web services. We are creating a bespoke Content Manager that calls these web services to retrieve notebooks and data sets from a cloud based file abstraction service and the web services require stateful information that is being stored in Jupyterlab containers as environment variables.)

What is the recommended approach for updating the state of a running Jupyer Lab server instance. IS there a Jupyterlab REST API mechanism that we can extend? Please advise.

Answered my own question. Jupyter lab server extensions.

Server Extensions — Jupyter Server 1.11.0.dev0 documentation. (how to build jupyter server extensions)

extension-examples/server-extension at master · jupyterlab/extension-examples · GitHub . (Jupyter lab server extension examples – a specific type of jupyter server extension)

jupyter_server/examples/simple at master · jupyter-server/jupyter_server · GitHub. (Jupyter server extension examples. Jupyter lab is a server extension of jupyter server)