x-session header. All endpoints therefore require a valid session.
Supported methods
List of all supported methods.Basic concept
Mapping to shop actions
Internally, the writing endpoints execute the same shop actions as the forms in the template. The error codes therefore come from these actions. You maintain their error texts in the configuration under actions - Test mode.Response on success
On success, all four endpoints respond with status 200 and the current state of test mode. The structure corresponds to the $wsTestMode module.searchTestApi switch
The searchTestApi switch does not change the shop itself. It is merely a signal to your storefront. Based on its value, the storefront decides whether to address the test API or the production API of WEBSALE Search.
The shop does not call WEBSALE Search itself. Instead, it only stores the switch in the session and passes it on in the response so that your storefront can react to it. You implement the switch to the test API in your storefront.
compileTemplates switch
With the compileTemplates switch, the shop compiles the views from the current template sources on every request instead of loading them from the precompiled theme. This makes changes to the templates immediately visible in your session. The switch only takes effect while test mode is active for the session, and only for that session. In the template, you query the state via $wsTestMode.compileTemplates.
Compiling on every request slows down page loads. Therefore, switch
compileTemplates off again as soon as you have checked the changes. You can do this with testMode/update and the value false.General responses
Methods for test mode
GET testMode/status
The following call returns the current state of test mode for the session.Parameter overview
Header parameters
Example response
POST testMode/activate
With the following call, you activate test mode for the session. Optionally, you can switch on extended debugging, the simulation of failed payments, the signal for the WEBSALE Search test API and template compilation. The call defines the initial state of test mode. Switches that you do not send are then off. If test mode is already active for the session, switches that are not sent keep their previous value.Example request
Parameter overview
Header parameters
Body parameters
Example response
Error codes
The lockout applies to the IP address, not to the session. A new session therefore does not lift it. During the lockout, the shop also rejects a correct password with
tooManyAttempts.POST testMode/deactivate
The following call deactivates test mode for the session. The shop resets the valuesactive, debug, makePaymentFail, searchTestApi and compileTemplates to false. A request body is not required.
Parameter overview
Header parameters
Example response
POST testMode/update
The following call changes thedebug, makePaymentFail, searchTestApi and compileTemplates switches without leaving test mode. The prerequisite is that test mode was previously activated with the password for the respective session.
The call only changes the switches that you send in the request. Switches that are not specified keep their previous value. All switches are therefore optional.
Example request
This request switchesdebug off and leaves makePaymentFail, searchTestApi and compileTemplates unchanged.
Parameter overview
Header parameters
Body parameters
With
testMode/update, only the switches you send are changed. To switch a switch off, explicitly send it with the value false. Omitting it means “do not change”. This way, existing integrations continue to work unchanged even if further switches are added later.This does not apply to the form on the shop’s test mode page. The TestModeChange action used there always sets all switches when saving. The reason is that the browser does not send an unchecked checkbox at all. A switch that is not checked in the form is therefore off after saving.
Example response
The response shows the state after the example request. Onlydebug has changed.
Error codes
Transition to the checkout
If you redirect from the storefront to a checkout of the template theme via session/prepareRedirect, test mode is retained because the shop takes over the session. The following applies to the rest of the process:- Orders receive the verification status “Test”. You can recognize them in the order overview in the admin interface and filter by the
verificationStatusfield via the Admin Interface API. - If
makePaymentFailis switched on, payments also fail in the checkout.
Related links
- $wsTestMode: query the test mode state in the template.
- TestMode actions: control test mode via forms in the template.
- actions - Test mode: error texts of the test mode actions.
- general.testMode: password, template and lockout after failed password attempts.
- Storefront API Session handling: create a session and pass it to the template theme.
- Search API: WEBSALE Search interface.
