- Introduction
- Create a Team Database
- Create a Developer API Service Account
- Configure Database Permissions
- Populate the Database with Profiles
- Mod Setup
Introduction
In this tutorial, you’ll learn how to use PixieBrix’s Team Database feature to implement per-user business logic.
This tutorial covers:
- Creating a Team Database to store user profiles/tags
- Populating the database using the Developer API
- Referencing a team member’s profile to determine brick execution in an mod
Create a Team Database
Create a Team Database in the admin console to store the user profiles:
In the dialog, give your database a name:
Create a Developer API Service Account
Create a service account
Configure Database Permissions
Configure group permissions for the database:
- Read: the Group of team members that will be using the mod
- Write: the Group your Developer API Service Account is in
Populate the Database with Profiles
To update organization database records, use the records endpoint:
PUT /api/databases/:databaseId/records/
The payload is the unique record id and data. Use the user’s email (all lowercase) as the id. And pass the custom profile data:
{
"id": "todd@pixiebrix.com",
"data": {
"isCool": true,
"heightInMeters": 1.93
}
}
Currently there are no bulk operations available on the database. Therefore, to add/update multiple records on the database, issue multiple requests.
429
response, wait a minute and the proceedMod Setup
Add the PixieBrix session reader brick, to get the email of the team member:
Add the “Get data from PixieBrix database” brick:
Change the output key to profile, and pass the email for the database record key:
In the subsequent bricks, you can now use the flags on the profile in brick inputs and conditions. For example, to configure a brick to run only if the isCool
flag is set for the team member: