Configuring an assembly function
An assembly function augments the assembly actions that the API gateway uses during processing.
About this task
You can implement an assembly function in one of the following ways.
- Define an assembly function to add custom logic to an assembly. After you define the assembly function, you can add it to a function call assembly action.
- When you configure the API Connect gateway service as not V5 compatible, use an assembly function to specify a user-defined policy (UDP) that API Connect advertises and makes available in the API Connect assembly editor. A UDP provides custom processing control of APIs in the gateway server.
To configure an assembly function, the only requirement beyond the name is to specify the assembly to apply to calls to the function.
If you configure parameters to pass to the assembly function, the parameter configuration has the
following settings.
- The name of the parameter.
- The label for the parameter that is advertised to API developers.
- A description of the parameter that is advertised to API developers.
- The API schema that is used to verify the parameter type.
- The default parameter value to pass to the assembly function as a string. The default value is
used when no value is passed in the request. You must define the default parameter value when the
assembly function is called in a function call assembly action and no parameter value is defined in
the action.
- If the default value is a JSON payload, enter the value as a JSON string.
- If the default value is an empty string, it is treated as not specified.
- If the assembly function parameter specifies an API schema, the default parameter value overrides the default value in the schema.
- The type of the parameter value. The default value is
string.string- Indicates that the value is a string. The value is set on the parameter as a JSON string. For
example, if the parameter name is
foo, the value is set onlocal.parameter.fooin the API context. This setting is the default value. payload- Indicates that the value is a payload. The payload is set on the
bodykey of the parameter as a binary blob. For example, if the parameter name isfoo, the payload is set onlocal.parameter.foo.bodyin the API context. If the root of the payload value is a JSON object, it must include a space after the first opening brace,{. For an XML tree or JSON document, the payload must be explicitly parsed. message- Indicates that the value is a message. The message contents are copied and set on the parameter.
For example, if the message is
fooand the parameter name isbar, then the keys and values offooare copied and set onlocal.parameter.barin the API context. The message must be a JSON object that includes a payload set to thebodykey. The payload cannot be a stream.
- The indicator for whether the parameter requires a value in an assembly function call. This setting is relevant only when a value is not specified. When a value is specified, this setting is ignored.