Using API Inspector
When you find an API does not behave as your expected, one way to troubleshoot it is to use API Inspector to what is under the hood during runtime.
This example shows you how to setup and use API inspector in action. If you want to see the detail of the settings in API Inspector. please refer to API Inspector Settings.
Add Inspector Setting
Go to the AlchemyJ ribbon, click the Inspector Settings in the Troubleshoot group.
A new worksheet ##InspectorSettings will be added to the workbook. In the ##InspectorSettings, each section represents an inspector action.
Define and Activate Inspector Setting
We use Sample REST API as an example in this tutorial. We will enable the Generate API Inspector Excel File command and show the value of it is request parameter in API Inspector
Specify the Excel file path in the Generate API Inspector Excel File section. Input the function name and set the Disable column to 'No' or blank.
The function point name in the View Request Parameter section and set the Disable column to 'No'.
Go to the AlchemyJ ribbon, click the Activate Inspector Settings in the Troubleshoot tab. AlchemyJ will generate and export the settings into a JSON file in the same folder of the workbook.
{
"basicSettings": {
"API Inspector listening port": "9898"
},
"commandActions": [
{
"action": "generate-debug-excel",
"parameters": {
"functionPoint": "Function Point 1",
"folderPath": "D:\\Temp"
}
},
{
"action": "view-req-param",
"parameters": {
"functionPoint": "Function Point 1"
}
}
]
}
Enable the Debugging Mode
API Inspector only works in Debug mode. Thus, we shall enable debug mode before generating the API.
Go to the AlchemyJ ribbon, click on Settings.
Go to the API Generation tab on the dialog box. Select Debug on the Generation mode.
Generate the API and run it.
Launch API Inspector
After the API has been generated and is running, we shall launch the API Inspector Console to see the result.
Go to the AlchemyJ ribbon, click the API Inspector. The AlchemyJ API Inspector Console will be launched.
Run the API using the OpenAPI Specification or in the below case, trigger it directly using an URL.
You can see the request parameter and the debug excel file path information are shown in the inspector console.