This API manages the vtex_session
cookie, which holds session-related data for users. Developers can either interact with the API endpoints directly or declare this app as a dependency to leverage its React functions.
Schema overview
Query
classDiagram
direction LR
class Query {
String version
session(items [String]) Session
}
class SessionError {
String type
String message
}
class SessionSuccess {
String! id
SessionNamespaces namespaces
}
%% Links between classes
Query --> Session : session
Session --> SessionError : possibleType
Session --> SessionSuccess : possibleType
%% Click events
click Query href "#query"
click Session href "#session"
click SessionError href "#sessionerror"
click SessionSuccess href "#sessionsuccess"
Field | (argument) | Type | Description |
---|---|---|---|
session | Session | Retrieves the vtex_session cookie content if successful. The Get session endpoint from the Session Manager API is an equivalent implementation in REST. The Session union has two possible types: SessionError and SessionSuccess . | |
items | [String] | Specifies the items from the vtex_session cookie that will be returned in the response. Each string defines the namespace and value of the items, with the "{namespace}.{value}" format. If this argument isn't declared, the response will have all the items in the namespace field. Example: ["store.channel", "store.countryCode", "impersonate.canImpersonate"] . |
Mutation
classDiagram
direction LR
class Mutation {
updateSession(fields SessionFieldsJSONInput!, items [String]) Session
}
class SessionError {
String type
String message
}
class SessionSuccess {
String! id
SessionNamespaces namespaces
}
%% Links between classes
Mutation --> Session : updateSession
Session --> SessionError : possibleType
Session --> SessionSuccess : possibleType
%% Click events
click Mutation href "#mutation"
click Session href "#session"
click SessionError href "#sessionerror"
click SessionSuccess href "#sessionsuccess"
Field | (argument) | Type | Description |
---|---|---|---|
updateSession | Session | Updates fields in the public namespace of the vtex_session cookie and returns the updated content. The Edit session endpoint from the Session Manager API is an equivalent implementation in REST. The Session union has two possible types: SessionError and SessionSuccess . | |
fields | SessionFieldsJSONInput! | A JSON object with the public fields to be updated. Since this is equivalent to a PATCH request, the request will have the following behavior with this field:
{ "foo": 123, "baz": "abc" } . | |
items | [String] | Specifies the items from the vtex_session cookie that will be returned in the response. Each string defines the namespace and value of the items. If this argument isn't declared, the response will have all the items in the namespace field. Example: ["store.channel", "store.countryCode", "impersonate.canImpersonate"] .Tip: To only show the updated fields in the response, use the public namespace along with the field name. Example: ["public.supportedLocales"] . |
Schema description
Arguments must be provided by the user. Required fields are marked with an exclamation mark (
!
).
SessionError
Field | (argument) | Type | Description |
---|---|---|---|
type | String | Session error type. | |
message | String | Session error message. |
Session 🔽
SessionSuccess
Field | (argument) | Type | Description |
---|---|---|---|
id | String! | Session ID. | |
namespaces | SessionNamespaces | Namespaces object with the content of the vtex_session cookie. Each namespace has fields with specific information about the session. Check all the possible namespaces in the Sessions System documentation. |
Session 🔽
Session
Type | Description |
---|---|
SessionError | Returned when a session error occurs. It provides the error type and message. |
SessionSuccess | Returned when the operation succeeds. It includes the content of the session cookie. |
Query 🔼
Mutation 🔼