You can use the NetSuite Debugger to debug RESTlet code in the same manner that you debug other types of SuiteScript code.
If you have installed and set up the SuiteCloud IDE, a debug client is available for your use. The RESTlet/Suitelet Debug Client enables you to debug deployed RESTlet and Suitelet SuiteScripts with the SuiteCloud IDE Debugger. The client is only accessible after a debug session is started. For information about SuiteCloud IDE, see SuiteCloud IDE Plug-in for Eclipse Guide.
In addition to debugging RESTlet script code, you should test the HTTP request to be sent to the RESTlet. Free tools are available for this purpose, such as Send HTTP Tool (https://www.softpedia.com/get/Internet/Servers/Server-Tools/WIN-HTTP-Sender.shtml).
To debug a deployed RESTlet:
Before you deploy a RESTlet to be debugged, ensure that the script does not include the HTTP authorization header, as this header can prevent the debugger from working.
Ensure that on the script deployment record, the Status value is set to Testing.
Go to Customization > Scripting > Script Debugger.
Click the Debug Existing button in the main Script Debugger page.Note:
This button only appears when you have deployed scripts with the status is set to Testing.
Select the RESTlet script that you want to debug in the Script Debugger popup.
After you click the Select option button, the RESTlet's cookies display in a banner.
Copy the cookies and paste them into a text file so that you have them available.
Click the Select and Close button in the Script Debugger popup.
The main Script Debugger page displays a message that it is waiting for user action.
Set the cookies in your client application to the values you copied in step 6, and send the RESTlet request.
The main Script Debugger page displays the script execution as pending at the NetSuite function
With the script loaded into the Debugger, you can now step through each line to inspect local variables and object properties. You can also add watches, evaluate expressions, and set break points. See Script Debugger Interface for information about stepping into/out of functions, adding watches, setting and removing break points, and evaluating expressions.