Request Context Object
The Request Context object is sent with every request. It contains information about who made the request, and which site and which external collection configuration made the request. Use the member_id
in the request context object to implement permissions in your adapter.
Settings
The contents of the settings
object are static and set in the Configuration section when setting up the external collection. Use the settings object to carry any static data you want to send to the adapter from your site.
The prototype adaptor uses the settings object to receive the secretKey
for authentication. Add attributes to the settings object to support any functionality you want to implement in your adapter.
instance_id
The instance_id
is a UUID that uniquely identifies the Wix site that is making the request. You can create an external database collection in more than one Wix site that points to the same adaptor and external database. Use the instance_id to control access to your date on a per-site basis.
installation_id
The installation_id
is a UUID that uniquely identifies the external collection configuration within your site. You can create more than one external collection in the same site that points to the same adaptor and external database. Each of these external collections will be identified by its own UUID, allowing you to implement different functionality and permissions for each one.
member_id
The member_id
identifies the site visitor making the request. When creating new items, the Wix data backend populates the _owner
attribute with the member_id. If the visitor is not a logged-in member, the member_id is based on a browser cookie and therefore consistent between sessions.
The member_id will be null if the code that made the request was triggered by a backend process. Use member_id to filter data by user and to implement permissions in your adapter.
member_role
The member_role
describes the role of the site visitor making the request. If the request is made by backend code and the find()
function uses the suppressAuth
option, the member_role
will be set to BACKEND_CODE
and the member_id
will be null
. In all other cases where backend code makes the request, the member_role
will be set to VISITOR
and the member_id
will be null
.
Attributes
NAME
TYPE
DESCRIPTION
The ID of the Wix site making the request.
Supported values: VISITOR
, MEMBER
, OWNER
, BACKEND_CODE
.
The role of the user or process making the request.
The ID of the external collection making the request.
The ID of the site visitor making the request.
The JSON defined in the Configuration
section of the External Database Collections setup.
Was this helpful?
Request Context
Example request context object.
Object
json
12{"requestContext": {3 "settings": {"secretKey": "mySecureSecret"},4 "instanceId": "12a345b6-7890-98d7-65e4-f321abc1de23",5 "installationId": "987fe654-3d21-4def-ab5c-6d78e90f123a",6 "memberId": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",7 "role": "OWNER"8}}