WSVersionMode
Defines the method of access when the GWS generates the OpenAPI documentation.
Syntax
WSVersionMode = "{
uri |
header |
query }
"
- WSVersionMode has three options:
uri
,header
, orquery
. It is a string value setting. It can only contain one value.
WSVersionMode
is an optional attribute that is only allowed in the service information record of the
module.Usage
WSVersion
function and module attributes activate
versioning mode. In the default versioning mode, the GWS automatically prefixes the version to the
operation's resource path in the OpenAPI documentation. This is the uri
versioning
mode.
For example, if before versioning, the resource path as defined by WSPath
was:
/prices/{nb}
After versioning the operation (the version is set as "v2"), the resource path is:
/v2/prices/{nb}
Access to operations can be changed with the optional attribute WSVersionMode
on
the service information
record.
You can set the versioning mode to one of the three supported versioning methods; versioning the URI, adding a custom header, or using a query string, depending on your preference. The GWS generates the OpenAPI documentation and creates the functions in the stub file for the version based on the mode. The whole REST Web service will use the same access mode.
To learn about version mode (to include how the GWS handles version mode in the OpenAPI description of operations ), see Specify version mode.
Example using WSVersionMode
/users?api-version=v2
. Client applications need to provide a value for the query
parameter (api-version
) when making a call to the service.
PUBLIC DEFINE serviceInfo RECORD ATTRIBUTE(WSInfo, WSScope="users", WSVersion="v2" WSVersionMode="query")
title STRING,
description STRING,
termOfService STRING,
contact RECORD
name STRING,
url STRING,
email STRING
END RECORD,
version STRING
END RECORD = (
title: "my service",
version: "1.0",
contact: ( email:"helpdesk@mysite.com") )
WSInfo
attribute) is to document the REST service. If you are not setting the
version mode, the record is still needed to provide service information.