Running a Groovy Service
After creating and populating your Groovy service, you may want to run it. Running a Groovy service is a pretty straightforward process, just do the following:
-
From the Coder Navigator view, right click on the Groovy class or script which contains the service1 you want to run, then click Invoke in Browser.
Invoke in HTTP Client
Aside from invoking a service via the browser, you can also invoke services via the HTTP Client. The HTTP Client is a neat API development tool introduced in Coder Studio v1.3 that allows developers to compose advanced requests for testing their APIs. As of now, there is no counterpart for this feature in Coder Cloud.
-
Select the service you want to run from the appearing dialog.
Extra services
Aside from the services explicitly declared in your script, you many find other services by checking the "Show hidden services" checkbox. These services are from your class or script's superclass. Thus, if you have used inheritance, you will also see the services of the inherited class.
-
Click OK (or Invoke, in Coder Cloud). A new browser tab will open up displaying the details of the service you are about to invoke.
The newly launched tab displays an interface we know as the service invoker. This page contains the description of the service you are trying to invoke (retrieved from the provided Groovydoc), the parameters of the service and their descriptions, request and response type options, and the invoke URL for the service.
If your service has input parameters, you may populate them with data. When you're ready to finally run your service, simply click the Invoke button.
Use the run icon to run Groovy services
You can run Groovy services in Coder Studio by opening the file and clicking the run icons beside the line numbers. You will find these icons across method signatures. Doing so will open the invoke window for the service.
-
Groovy services, simply put, are Groovy methods or scripts. ↩