Skip to main content

How to expose an Atoti application to Atoti Python API

In this guide, we will perform all the necessary changes to expose a custom Atoti application as a backend for Atoti Python API.
At the end of this guide, you will be able to connect to your application from the Python API.

In this guide, we assume the project is using Maven and Spring Boot configured with a file application.yml.

danger

The Atoti Python API is a complete API to configure an Atoti application. As such, it must be considered like an open door to the application as much as any system allowing to run Java code on the server. Thus, it is not recommended to expose such a feature in a production environment.
See this document for more information.

1. Add the starter to your project

The very first step to expose your project is to add a dependency to the Atoti Runtime Starter.

<dependency>
<groupId>com.activeviam.springboot</groupId>
<artifactId>atoti-runtime-starter</artifactId>
<version>6.1.1</version>
</dependency>

2. Define a technical user

In addition to the Py4j socket, Atoti Python API uses some HTTP calls - REST and GraphQL - to interact with the Atoti application. These calls are authenticated with a JWT, retrieved through the Py4J socket.
This user must be granted with the roles ROLE_ADMIN and ROLE_USER to perform all the necessary operations.

In the application.yml file, we add the following line, to point to an existing user with such roles.

# In this example, admin is the existing user with the required roles
atoti.server.runtime.technical-user.name: "admin"

3. Re-export the GraphQL schema

Finally, while Atoti Runtime Starter ships all the necessary resources, we still need to manually re-export the GraphQL schema to the client in the Python API.

spring:
graphql:
schema:
locations: "classpath*:graphql/**/"

Play with your application

After this point, it is possible to start a Python notebook or script and connect to your application.
To know how to set up the Python API to use your application, head to Atoti Python API.