Sessions API handler
Get the current session.
HTTP Verb – GET
URL – /api/v1/sessions/current
Description – Get the current session.
Base – HandlerBase<GetSessionParameter, GetSessionResult>
Handlers –
Order | Handler | Description |
---|---|---|
500 | GetContext | Retrieves site context objects, like language, currency, device type, and persona, and stores them on the result object. |
600 | GetUserInfo | Retrieves data for the current user. This includes username, email, first name, roles, and whether or not the current user is allowed to access the current website. This data is stored on the result object. |
700 | GetCustomerInfo | Retrieves bill-to and ship-to customer data for the current user. |
800 | GetDeliveryInfo | Retrieves fulfillment method and pick up warehouse data, and stores them on the result object. |
1000 | GetPunchoutSettings | Retrieves Punchout settings related to the session, specifically whether or not to display the change customer link. During a Punchout session, you cannot change the customer from within Configured Commerce. |
HTTP Verb – POST
URL – /api/v1/sessions
Description – Post to session endpoint to sign in.
Base – HandlerBase<AddSessionParameter, AddSessionResult>
Order | Handler | Description |
---|---|---|
400 | RemoveImpersonateCookies | Removes the impersonation cookie, if one exists. The impersonation cookie is created when an Admin user starts an impersonation session from within the Admin Console. |
500 | ValidateContext | Validates that a session can be added for a user. The user is specified using the UserName property on the parameter object. An error is returned if ANY of the following are true: User is not foundUser is deactivatedUser needs to change his/her passwordUser is locked outUser is not allowed to access the current website If none of those are true, the user profile is stored in the UserProfile property on the result object. |
600 | SetUserAsAuthenticated | Signs in a user and updates the last login datetime for that user. The user is specified using the UserNameproperty on the parameter object. |
700 | SetSiteContext | Initializes the current site context. This includes setting the current currency and the user profile (if the user elected to be remembered after login). |
800 | UpdateCart | Updates the cart using the current bill-to and ship-to customers. Uses theUpdateCartHandlerhandler chain. |
900 | CreateGetSessionResult | Retrieves the newly created session using theGetSessionHandler handler chain and stores it in the GetSessionResultproperty on the result object. |
HTTP Verb – PATCH
URL – /api/v1/sessions/current
Description – Patch to session endpoint with billtoid, shiptoid, language code and/or currency code to change the context.
Base – HandlerBase<UpdateSessionParameter, UpdateSessionResult>
Order | Handler | Description |
---|---|---|
100 | ValidatePunchout | Validates that certain actions are not being requested if a Punchout session is active. The following actions are not allowed: Reset password Change password Change ship-to customer |
500 | ResetPassword | Sends a password reset email to a user. The email contains a link that allows the user to reset his/her password. If the ResetPasswordproperty on the parameter object equals "false", this handler is skipped. The user is found using either the Emailor UserNameproperty on the parameter object. |
600 | ActivateAccount | Sends an account activation email to a user. The email contains a link that allows the user to activate his/her password. If the ActivateAccountproperty on the parameter object equals "false", this handler is skipped. The user is found using either the Emailor UserNameproperty on the parameter object. |
700 | ChangePassword | Changes a password for a user. The Passwordand NewPasswordproperties on the parameter object are required. |
800 | ChangePasswordWithToken | Changes a password for a user, using a reset token. The ResetTokenand NewPasswordproperties on the parameter object are required. If the password is changed successfully, the user account is also unlocked. |
900 | SetLanguage | Sets the language on the current site context. The language is found using theLanguageIdproperty on the parameter object. If the LanguageIdproperty on the parameter object is blank, this handler is skipped. |
1000 | SetCurrency | Sets the currency on the current site context. The currency is found using the CurrencyIdproperty on the parameter object. If the CurrencyIdproperty on the parameter object is blank or the CurrencyIdmatches the current currency, this handler is skipped. |
1100 | UpdateUserProfile | Updates the default customer for the current user. Also, updates whether or not the homepage is the dashboard page. |
1200 | SetBillTo | Sets the bill-to customer on the current site context. The bill-to customer is found using the BillToIdproperty on the parameter object. |
1300 | SetShipTo | Sets the ship-to customer on the current site context. The ship-to customer is found using the ShipToIdproperty on the parameter object and the current bill-to customer. |
1400 | UpdateCart | Updates the cart using the current bill-to and ship-to customers. Uses the UpdateCartHandler handler chain. The cart is updated if either the bill-to or ship-to customers were changed in previous handlers. |
1500 | CreateGetSessionResult | Retrieves the newly created session using the GetSessionHandler handler chain and stores it in the GetSessionResult property on the result object. |
HTTP Verb – DELETE
URL – /api/v1/sessions/current
Description – Delete to session endpoint signs out.
Base – HandlerBase<RemoveSessionParameter, RemoveSessionResult>
Order | Handler | Description |
---|---|---|
500 | RemoveSession | Signs out the current user and removes objects from the site context, including bill-to and ship-to customer, persona, and remembered user profile. |
600 | RemoveImpersonateCookies | Removes the impersonation cookie, if one exists. The impersonation cookie is created when an Admin user starts an impersonation session from within the Admin Console. |
PunchOut references
PunchOut2Go rebranded to TradeCentric in June 2022. Code may still refer to PunchOut.
Updated over 1 year ago