1
Create the base connection
This is the default connection that will be used when no user attribute matches an environment connection. Use the Create a connection API to create the connection.In this example, this would be a connection to your development database:
POST /api/v1/connections
2
Create environment connections
Environment conditions are additional connections with the same dialect as the base connection. Use the Create a connection API to create the connection(s).In this example, this would be a connection to your production database:
POST /api/v1/connections
3
Connect the base and environment connections
Use the Create connection environments API to associate the base connection with the environment connections. Provide the following:
baseConnectionId- The ID of the base connection. In this example, that’s your development database.environmentConnectionIds- The ID(s) of the connection environments. In this example, that’s your production database.
POST /api/v1/connection-environments
4
Configure the base connection user attribute
Use the Update a connection API to specify which user attribute will be used to determine the connection environment.In this example, configure the base connection to use the
environment user attribute and set its default value to dev:PATCH /api/v1/connections/:id
5
Define user attribute values for environments
Use the Update connection environment user attributes API to specify which user attribute values will trigger the use of each environment connection.In this example, set the user attribute values for the production environment connection to Now, users with the
prod:PUT /api/v1/connection-environments/:id
environment attribute set to prod will use the production database, while users with the environment attribute set to dev (or any other value not associated with an environment connection) will use the development database.