Logic constructs

IBM API Studio includes a number of logic constructs that you can use to apply preconfigured logic to an assembly to control the flow of data through your assembly when the API is called.

Logic constructs control how the assembly flow executes. They allow you to apply conditions, choose branches, return early, or handle errors without modifying the request or response data.

Table 1. Logic construct policies
Policy Description
If Applies a condition and runs a section of the assembly only when the condition evaluates to true.
Operation Switch Runs a section of the assembly based on the API operation selected by the client.
Return Stops processing immediately and returns a configured response.
Switch Evaluates multiple cases and selects the first matching branch.
Throw Generates an error that can be handled by a Try construct.
Try Wraps a sequence of policies with error-handling behavior and provides a fallback path.