API Editor - Creating Path Parameters
This feature allows a user to quickly add Path parameters to a service and all its methods. If a service has many methods, this feature can save a lot of time: instead of manually editing the service interface, service implementation and service controller .java files, the user can add all changes to these files at once.
Path parameters can be added only for services of REST-type projects.
The user can add Path parameters to the service or to each method of the service separately. When the user adds a new Path parameter to the service, this parameter will be added to the Input of all methods of the service. When the user adds a new Path parameter to a method of the service, this parameter will be added only to the Input of this method.
In both cases, Path parameter will be added to the Input of the method, and it also will be added as parameter with @PathParameter annotation for declaration of the method in the Service Controller file.
How to Create a Path Parameter
To create a new Path parameter, the user should add the name of the parameter inside curly brackets "{ }" to the path of the service or method. Please note that all Path parameters will have String type in the method's Input by default, and they will be added to the Input and controller only after saving changes. Keep in mind that the name of the parameter should be a valid Java identifier and it must not be a Java language keyword or reserved word.
To add a new Path parameter:
For Service, the user needs to modify a value of Base Path in the General tab:
For Method, the user needs to modify a value of Method Path in the Methods tab:
For example, if the user wants to add a new Path parameter with the name "id" to a method with path "/clients", the user should add it to the method's path "/{id}". After saving, the method will have the path "/clients/{id}" and a new parameter in its Input with the name "id" and with type String. The user can find it in the Input/Output tab: