Importing necessary modules
Then you need to import
org to proceed with the next steps.
from aiaengine.api import org
Creating an organization
Now you can create an organization with input
description. A unique id is generated for the organization and will be frequently used in relevant functions.
create_org_response = client.orgs.CreateOrg( org.CreateOrgRequest( name='Org Name', description='What is your org about' ) ) org_id = create_org_response.id
Retrieving information of an organization
You can retrieve information of an organization that has been created by specifying the
client.orgs.GetOrg( org.GetOrgRequest( id='id_of_org' ) )
Updating information for an organization
You can also update the name and description for an exisiting organization.
client.orgs.UpdateOrg( org.UpdateOrgRequest( id='id_of_updated_org', name='Updated Org', description='This org has been updated', logo_url='url_of_logo_if_available' ) )
Deleting an organization
If an organization is no longer needed, you can remove it by specifying the
client.orgs.DeleteOrg( org.DeleteOrgRequest( id='id_of_deleted_org' ) )
Listing organizations for a user
For a particular user, you can list all the organizations that this user are associated with by specifying the user id.
client.orgs.ListOrgs( org.ListUserOrgsRequest( user_id='id_of_user' ) )
user_id is omitted or set to
None, the above code returns the list of organizations associated with the current user.
Listing users that can access an organization
Similarly, you can list all the users who can access to an organization by proving the
client.orgs.ListOrgUsers( org.ListOrgUsersRequest( id='id_of_org' ) )
Adding a user to an organization
By specifying the id and role of an existing user in the platform, you can add the user into your organization.
client.orgs.CreateOrgUser( org.CreateOrgUserRequest( id='id_of_org', user_id='id_of_added_user', role_id='org-editor' ) )
Deleting a user from an organization
Once a user does not belong to your organization, you can remove the user by specifying both ids of your organization and the user.
client.orgs.DeleteOrgUser( org.DeleteOrgUserRequest( id='id_of_org_that_user_can_access', user_id='id_of_user_whose_access_to_org_is_deleted' ) )