From b3f6344f06ffbe1843e77b8c12f7f66a17074757 Mon Sep 17 00:00:00 2001 From: Andreas Hellander Date: Sat, 6 Jul 2024 09:51:32 +0200 Subject: [PATCH] Make the APIClient page Studio-centric --- docs/apiclient.rst | 21 ++++++++++----------- docs/quickstart.rst | 5 ++--- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/apiclient.rst b/docs/apiclient.rst index b4dfd789f..87707dfd2 100644 --- a/docs/apiclient.rst +++ b/docs/apiclient.rst @@ -1,11 +1,7 @@ APIClient ========= -.. note:: - - For access to FEDn Studio API, please see :ref:`studio-api`. - -FEDn comes with an *APIClient* for interacting with the FEDn network. The APIClient is a Python3 library that can be used to interact with the FEDn network programmatically. +FEDn comes with an *APIClient* - a Python3 library that can be used to interact with FEDn programmatically. **Installation** @@ -17,12 +13,15 @@ The APIClient is available as a Python package on PyPI, and can be installed usi **Initialize the APIClient** -To initialize the APIClient, you need to provide the hostname and port of the FEDn API server. The default port is 8092. The following code snippet shows how to initialize the APIClient: +The FEDn REST API is available at /api/v1/. To access this API you need the url to the controller-host, as well as an admin API token. The controller host can be found in the project dashboard (top right corner). +To obtain an admin API token, navigate to the "Settings" tab in your Studio project and click on the "Generate token" button. Copy the 'access' token and use it to access the API using the instructions below. + .. code-block:: python - - from fedn import APIClient - client = APIClient("localhost", 8092) + + >>> from fedn import APIClient + >>> client = APIClient(host="", token="", secure=True, verify=True) + **Set active package and seed model** @@ -38,9 +37,9 @@ To set the initial seed model, you can use the following code snippet: client.set_active_model(path="path/to/seed.npz") -**Start training session** +**Start a training session** -Once the active package and seed model are set, you can connect clients to the network and start training models. The following code snippet initializes a session (training rounds): +Once the active package and seed model are set, you can connect clients to the network and start training models. The following code snippet starts a traing session: .. code-block:: python diff --git a/docs/quickstart.rst b/docs/quickstart.rst index a73434328..7ae3883d5 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -98,9 +98,7 @@ It is also possible to upload a package and seed model using the Python API Clie Do this by going to the 'Settings' tab in FEDn Studio and click 'Generate token'. Copy the access token and use it in the APIClient below. The controller host can be found on the main Dashboard in FEDn Studio. - You can also upload the file via the FEDn Studio UI. Please see :ref:`studio-upload-files` for more details. - -Upload the package and seed model using the APIClient: +To upload the package and seed model using the APIClient: .. code:: python @@ -223,6 +221,7 @@ To start a client using Docker: **Where to go from here?** +-------------------------- With you first FEDn federated project set up, we suggest that you take a close look at how a FEDn project is structured and how you develop your own FEDn projects: