fglrestful

The fglrestful tool produces REST web services stub files for client programs using an OpenApi specification.

Syntax

fglrestful [ options ] service
  1. options are described in fglrestful options.
  2. service is the OpenApi service definition file or URL.

Options

Table 1. fglrestful Options
Options Description
-V or --version Displays version information.
-h or --help Displays options for the tool.
-l or --list { path | resource } List all the paths or resources of a service. For example, fglrestful -l resource http://localhost:8090/MyService?openapi.json lists the resources.
-o or --output filename Specify a name for the output stub file.
-n or --name resource In a service providing access to one or more resources, specify the creation of a stub file for a given resource. For example, this command generates a separate stub file for the users resource:
fglrestful -n users http://localhost:8090/MyService?openapi.json
-p or --prefix prefix Set a prefix for constants and variables.
-b or --binary { byte | file } Specify that binary types are generated as either BYTE or FILE types in the stub.
-f or --format { XML | JSON } Specify the preferred REST format (XML or JSON).
-a or --oauth { yes | no | openapi } Generates OAuth support, default is openapi.
-t or --token token Specify the access token value if the service is protected by an access token.
-k or --tokenfile filename Specify the access token file if the service is protected by an access token.
--comment Add comments to the generated stub file. When you specify this option, WSDescription set on any of the input and output parameters of a REST function are generated on the client stub.
fglrestful -o stub_filename --comment http://localhost:8090/MyService?openapi.json
Note: WSDescription set on the ATTRIBUTES() clause of the function (as opposed to the attribute set on parameters) are generated even if the --comment option is not specified.
-W or --Warnings { yes | no } Specify if warnings should be output or not. By default the option value is yes, meaning the warnings are reported.
fglrestful -W yes -o stub_filename http://localhost:8090/MyService?openapi.json
Warnings are written to the standard output. The message gives the path in the openapi.json file where you locate the issue, and gives the reason.
Warning in /paths/Property/GetAllProperties/{applicationID}/{includeWillBeSold}/{update}/get/responses
Reason : Unsupported media='text/plain' on type='WebAPI_CreditAnalysis_Models_PropertyContainer'
Note: Errors are reported by default. The error message gives same kind of path, but with Error in instead of Warning in.

Usage

You use the fglrestful tool to generate the GWS client stubs from an OpenApi specification file (JSON format).

For example, to access a remote web service, you must get the REST information from the service provider. If the server supports the OpenAPI specification, the fglrestful command can generate the description of the service for access by a GWS client application.

If your REST service is written with Genero REST high-level API, a specification file is provided by default when you launch the service with the query string ?openapi.json or ?openapi.yaml. If the GWS Server was started on your local machine, for example, the OpenAPI information would be at:

http://localhost:8090/<service-name>?openapi.json
or
http://localhost:8090/<service-name>?openapi.yaml

The fglrestful command line tool supports OpenApi version 3.

For usage options, run the command fglrestful without any other parameters or with the help ( -h ) option.