Parameters define variable elements of a URL path, query parameters, headers, or a
request body. You can create parameters for Paths and Path operations in your API
definition.
Before you begin
Launch the parameter creation window. For details of the areas in your API definition from
where you can create a parameter, see the following topics:
About this task
Note:
- This task relates to configuring an OpenAPI 3.0 API definition. For
details on how to configure an OpenAPI 2.0 API definition, see Editing an OpenAPI 2.0 API
definition.
- OpenAPI 3.0 APIs are supported only with the DataPower® API Gateway, not with the DataPower Gateway (v5 compatible).
- For details of current OpenAPI 3.0 support limitations, see OpenAPI 3.0 support in IBM®
API Connect.
You can complete this task either by using the API Designer UI application, or by using the
browser-based API
Manager UI.
A parameter is similar to a header, with the following differences:
- Parameters carry actual data and are available to end users, headers carry meta data associated
with a request or response and are hidden from end users.
- A parameter can have various locations, the location of a header is always set to
header
.
- A parameter can have various format styles, the style of a header is always
simple
.
For more information on headers, see
Creating a
header.
At any time, you can switch directly to the underlying OpenAPI YAML
source by clicking the Source icon .
To return to the design form, click the Form icon .
Procedure
-
Create the parameter; you can either create a parameter from scratch, or you can reference a
parameter that is defined in a parameter component.
- To create the parameter from scratch, provide the following information on the
Definition tab:
- Name: Available if you are creating a parameter component, this name
defines a key that enables this parameter to be referenced from elsewhere in the API definition; the
reference has the following
format:
#/components/parameters/Name
Note: When the name of
a query parameter includes the "+" special character, it is encoded as %2B (literal plus character)
instead of %20 (literal space character). Therefore, to match the query parameter against the
inbound URL, the encoded value is used. For example, when the name of the query parameter is
a+space, the value to match in the inbound URL is a%2Bspace.
- Parameter name (required): The name of the parameter.
- Located In (required): The location of the parameter. Select one of the
following options:
- query: Parameters that are appended to the URL. For example,
url_path?myparam=myvalue
.
- header: Custom headers that are expected as part of the request.
- path: The parameter value is part of the operation's URL, enclosed in
{}.
- cookie: Used to pass a specific cookie value to the API.
- Description: A description of the parameter. You can use CommonMark syntax for rich
text representation.
- Style: Describes how the parameter value will be serialized depending on
the type of the parameter value. Select one of the following options:
- matrix: Path-style parameters defined by RFC
6570.
- label: Label style parameters defined by RFC
6570.
- simple: Simple style parameters defined by RFC
6570.
- form: Form style parameters defined by RFC
6570.
- spaceDelimited: Space separated array values.
- pipeDelimited: Pipe separated array values.
- deepObject: Provides a simple way of rendering nested objects using form
parameters.
- Select the following options as required:
- Required: Determines whether this parameter is mandatory. If the
Located In property is set to path, this option must
be selected.
- Deprecated: Specifies that a parameter is deprecated and should be
transitioned out of usage.
- Allows Empty Value: Allows sending a parameter with an empty value. This
is valid only if the Located In property is set to
query.
- Explode: When selected, parameter values of type
array
or object
generate separate parameters for each value of the array or key-value
pair of the map.
- Allow Reserved: Determines whether the parameter value should allow
reserved characters, as defined by RFC 3986 (
:/?#[]@!$&'()*+,;=
) to be
included without percent-encoding. This property applies only if the Located
In property is set to query.
- To reference a parameter that is defined in a parameter component, provide the following
information on the Reference tab:
- Name: Available if you are creating a parameter component, this name
defines a key that enables this parameter to be referenced from elsewhere in the API definition; the
reference has the following
format:
#/components/parameters/Name
Note: When the name of
a query parameter includes the "+" special character, it is encoded as %2B (literal plus character)
instead of %20 (literal space character). Therefore, to match the query parameter against the
inbound URL, the encoded value is used. For example, when the name of the query parameter is
a+space, the value to match in the inbound URL is a%2Bspace.
- Parameter name (required, available if you are creating a path or
operation parameter): The name of the parameter.
- Reference from: Select a reference to a parameter component.
- Click Create.