getMemberships
List DataSync memberships, optionally filtered by channel and/or user.
This API always queries the built-in Membership relationship class — there is no class-name query, only classVersion. Querying a Membership subclass is not supported here; that is served by the general /relationships API.
Results are scoped to the caller's access token: only memberships the token is permitted to read (get) are returned. Memberships the token cannot read are silently omitted — the call does not error and does not return a 403 for the un-readable memberships. Token scoping and the filterFast / filter / sort criteria are applied together, so the returned page never contains a membership the token cannot read regardless of the other criteria. When the PubNub instance is configured with a secretKey (a trusted server-side deployment, never a client — the secretKey must not be shipped to clients), or when using a token whose grants cover the whole result set, no permission-based filtering is applied and all matching memberships are returned, subject only to filterFast / filter / sort and limit paging.
Parameters
Optional Channel identifier to filter by. channelId and userId are independent, AND-ed equality filters on fixed sides of the membership: channelId matches the Channel (entity A) side and userId matches the User (entity B) side. Supplying only one narrows to memberships on that side; supplying both returns the membership(s) matching both (i.e. that specific channel-user pair); supplying neither lists all readable memberships.
Optional User identifier to filter by. See channelId for how the two combine.
Restricts results to a single version of the Membership class. If null, items of every version are returned, while filterFast, filter and sort fields are checked against the latest version. Pass a version to make results stable when new class versions are published.
Optional filter expression. For the built-in Membership class, filtering is allowed only on the built-in fields id, createdAt, updatedAt, and status (case-sensitive, exactly as spelled), which are filterable and sortable on both the filterFast and filter paths — except that status may be excluded when the class declares it as a projected field and the token cannot fully reach it. filterFast is strongly consistent — it always reflects the latest writes — but accepts fewer conditions than filter; a limit on the number of conditions applies and can be adjusted by PubNub support (see the PubNub DataSync documentation for the current limit). For larger or more complex queries use filter. At most one of filterFast and filter may be supplied; sending both is rejected by the server (HTTP 400).
Optional advanced filter expression. Uses the same syntax as filterFast and, for the built-in Membership class, targets the same built-in fields. It is not subject to the same condition limit, so use it for larger or more complex queries. The trade-off is consistency: filter is eventually consistent (recent writes may not yet be reflected), whereas filterFast is strongly consistent. At most one of filterFast and filter may be supplied; sending both is rejected by the server (HTTP 400).
Optional sort criteria applied in order; each PNDataSyncSortField sorts on a property either ascending (default) or descending. For the built-in Membership class, the sortable set is the built-in fields id, createdAt, updatedAt, and status (with the same status caveat as filterFast).
Optional page size, 1–100 (server default 20). A value outside that range is rejected by the server (HTTP 400), not clamped.
Optional opaque cursor for pagination (from a previous result's next.cursor).