I do not see in the code or in the API how to create a new organization. Are all the API endpoints documented somewhere? What is the best way to create a new organization in a multi-org configuration?
I ended up creating a record in the organizations table and records in the groups table to replicate how the setup.py script does it in single-org mode.
After that, I could create everything else via the API or CLI
@hara5 I manually inserted the data using SQL statements. If you analyze the database tables for organization, group, and user after standing up a new instance, you will see entries in these tables that you need to mimic.
If I remember right, a single user could not log into multiple organizations.
Otherwise you get 404 error. If you create another organization, just to set the âslugâ column, for example âfooâ, and to login just simple use:
I would like to know if it exist a better solution than manually to create organization.
I say that because I didnât find in the UI or script about this.
The unique answer, that I found, itâs manually with this post
Hi @Stristan, I merged your new topic with this one since theyâre the exact same issue.
@drumbsd has the right idea to manually insert orgs onto the organizations table. If you want to automate this you could add a CLI command here (weâd definitely review a PR for this).
Creating a new org with SQLAlchemy is straightforward. You create a new models.Organization object and pass it the desired name, slug, and settings objects.