The Access Groups API lets you retrieve the groups that control access to a site's members-only resources, such as members-only pages.
A group is what the site's dashboard calls a member role.
Site owners create roles in the dashboard, and apps create their own, such as Wix Pricing Plans, which creates a group for each pricing plan.
A site member gets access to a resource through the groups they belong to.
With the Access Groups API, you can:
- Retrieve the groups of a specific type that grant access to a site resource, for example, the pricing plans that unlock a members-only page.
- Retrieve the groups of a specific type that the logged-in site member belongs to, for example, to confirm that a member who bought a pricing plan can now access the plan's content.
It's important to note the following points before starting to code:
- Groups have a type that's set by the app that created them. Currently,
"plan" (groups created by Wix Pricing Plans) is the only type that site visitors and members can retrieve.
- For groups of type
"plan", the group ID is the pricing plan ID. Use it to retrieve the plan's details, such as its name and price, from the Pricing Plans API.
- Retrieving the logged-in member's groups requires a logged-in site member. Call it on behalf of the member, for example from the site's frontend.
- Only active memberships count. A membership that expired or hasn't started yet isn't returned.
- Results include groups of the current site, sorted by title. The built-in Admin and Member groups aren't included.
- Group: A set of site members that share access to site resources. The site's dashboard calls a group a member role.
- Group type: Value that identifies the app that created the group, for example
"plan" for groups created by Wix Pricing Plans.
- Resource: Something on a site that a group grants access to, usually a members-only page.
- Active membership: A member's membership in a group that has started and hasn't expired.