<commit_before>= Debug Mode
:page-sidebar: apim_3_x_sidebar
:page-permalink: apim/3.x/apim_publisherguide_design_studio_debug_mode.html
:page-folder: apim/user-guide/publisher/design-studio
:page-layout: apim3x


[label label-version]#New in version 3.16#

== Overview

From 3.16, we've updated the try it mode to offer new capabilities and view what's happening on each policy executed, now called Debug mode.

Debug mode is a tool for troubleshooting your API proxies running on APIM. It provides detailed information about the behavior of each policy in your flows as well as the overall execution order at runtime. With debug, you can:

* Understand which policies are triggered by a specific request (including Platform-level policies).
* Visualise which policies are executed or skipped (conditional policy).
* Understand the order of execution of your policies.
* Trace transformations and changes made to headers, body and execution context.
* Easily troubleshoot and find root cause of errors, misbehaviors or performance issues.

== How to Get Started With Debug Mode

. link:{{ '/apim/3.x/apim_publisherguide_design_studio_create.html' | relative_url }}[Design your API^].
. Select *Debug* tab.
. Configure your request.
. Select *Send*.

== How To Test Your API Concept with Debug Mode

You can send a request to your *API* endpoint through the embedded HTTP client available under the *Debug* tab.

NOTE: You don't need to save or redeploy the API to test your changes when using the Debug Mode.

image:{% link images/apim/3.x/api-publisher-guide/design-studio/debug-mode/debug-mode-example-empty.png %}[Debug Mode empty example]

The embedded HTTP client, let's you can configure different attributes of your request:

* *HTTP method* to select the HTTP verb (e.g., `GET`, `POST`, `PUT`, etc.).
* *Path* to test a specific subpath and provide query parameters. 

NOTE: The context-path of the API your are debugging is already taken into account. Path refers to the subpath: myapi-context-path/*path*?queryparam=value

* *Headers* to provide a custom list of HTTP request headers.
* *Request body* to configure a custom request body. 

Since debug mode emulates an external call to your API, it will resolve the flow as the gateway would do, so if you want to debug a specific flow you must configure your request (path, headers) to replicate the conditions at which the flow is triggered.

image:{% link images/apim/3.x/api-publisher-guide/design-studio/debug-mode/debug-mode-example.png %}[Debug Mode example]

The debug mode displays all policies in a vertical timeline so you can easily visualize the exact order of execution.

=== Different state for policies :

image:{% link images/apim/3.x/api-publisher-guide/design-studio/debug-mode/debug-mode-legend.png %}[Debug Mode legend]

* *executed* - the policy has been executed properly
* *skipped* - the policy is contains a condition that has been fulfilled. Refer to the information panel for more details on the evaluation of the condition.
* *error* - an error occurred during policy execution. Refer to the information panel for more details on the error.

By selecting a specific policy in the timeline, you have access to additional information regarding the input/output of the policy:

* header
* context attributes
* body

The inspector relies on 3 colors to indicate the nature of the change:

* *green* color indicates a addition
* *orange* color indicates a edition
* *red* color indicates a deletion

image:{% link images/apim/3.x/api-publisher-guide/design-studio/debug-mode/debug-mode-inspector.png %}[Debug Mode inspector]

=== Timeline

==== How to interpret ?<commit_msg>resolve typo<commit_after>= Debug Mode
:page-sidebar: apim_3_x_sidebar
:page-permalink: apim/3.x/apim_publisherguide_design_studio_debug_mode.html
:page-folder: apim/user-guide/publisher/design-studio
:page-layout: apim3x


[label label-version]#New in version 3.16#

== Overview

From 3.16, we've updated the try it mode to offer new capabilities and view what's happening on each policy executed, now called Debug mode.

Debug mode is a tool for troubleshooting your API proxies running on APIM. It provides detailed information about the behavior of each policy in your flows as well as the overall execution order at runtime. With debug, you can:

* Understand which policies are triggered by a specific request (including Platform-level policies).
* Visualise which policies are executed or skipped (conditional policy).
* Understand the order of execution of your policies.
* Trace transformations and changes made to headers, body and execution context.
* Easily troubleshoot and find root cause of errors, misbehaviors or performance issues.

== How to Get Started With Debug Mode

. link:{{ '/apim/3.x/apim_publisherguide_design_studio_create.html' | relative_url }}[Design your API^].
. Select *Debug* tab.
. Configure your request.
. Select *Send*.

== How To Test Your API Concept with Debug Mode

You can send a request to your *API* endpoint through the embedded HTTP client available under the *Debug* tab.

NOTE: You don't need to save or redeploy the API to test your changes when using the Debug Mode.

image:{% link images/apim/3.x/api-publisher-guide/design-studio/debug-mode/debug-mode-example-empty.png %}[Debug Mode empty example]

The embedded HTTP client let's you configure different attributes of your request:

* *HTTP method* to select the HTTP verb (e.g., `GET`, `POST`, `PUT`, etc.).
* *Path* to test a specific subpath and provide query parameters. 

NOTE: The context-path of the API your are debugging is already taken into account. Path refers to the subpath: myapi-context-path/*path*?queryparam=value

* *Headers* to provide a custom list of HTTP request headers.
* *Request body* to configure a custom request body. 

Since debug mode emulates an external call to your API, it will resolve the flow as the gateway would do, so if you want to debug a specific flow you must configure your request (path, headers) to replicate the conditions at which the flow is triggered.

image:{% link images/apim/3.x/api-publisher-guide/design-studio/debug-mode/debug-mode-example.png %}[Debug Mode example]

The debug mode displays all policies in a vertical timeline so you can easily visualize the exact order of execution.

=== Different state for policies :

image:{% link images/apim/3.x/api-publisher-guide/design-studio/debug-mode/debug-mode-legend.png %}[Debug Mode legend]

* *executed* - the policy has been executed properly
* *skipped* - the policy contains a condition that has been fulfilled. Refer to the input/output inspector for more details on the evaluation of the condition.
* *error* - an error occurred during policy execution. Refer to the input/output inspector for more details on the error.

By selecting a specific policy in the timeline, you have access to additional information regarding the input/output of the policy:

* header
* context attributes
* body

The inspector relies on 3 colors to indicate the nature of the change:

* *green* color indicates a addition
* *orange* color indicates a edition
* *red* color indicates a deletion

image:{% link images/apim/3.x/api-publisher-guide/design-studio/debug-mode/debug-mode-inspector.png %}[Debug Mode inspector]

=== Timeline

==== How to interpret ?
{'fraction_non_alphanumeric': 0.07692307692307693, 'fraction_numerical': 0.004098920617570706, 'mean_word_length': 4.562310030395137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3319295', 'n_tokens_mistral': 2032, 'n_tokens_neox': 1949, 'n_words': 947}