Overview
The DataVirtualizationResponseSetter custom transformer is designed to assist in the configuration of HTTP responses within the context of FME's Data Virtualization functionality. This transformer allows users to construct and populate the required HTTP response attributes by providing a simplified user interface for specifying standard response values. It is particularly useful when simulating or defining API response outputs for virtualized data services.
Input Ports
Input: Accepts any feature. Only attribute values are used by this transformer; geometry is ignored.
Output Ports
Output: Passes through the input feature, augmented with the specified http_response attributes.
Generated Attributes
This transformer adds the following attributes to the feature under the http_response group:
http_response.response.status_code: The HTTP response code (e.g., 200, 404).
http_response.response.body.content: The body content of the HTTP response, defined by the user.
http_response.response.body.content_type: The MIME type of the body content (e.g., application/json, text/plain).
http_response.response.body.content_file_path: Optional file path to the response body content, used as an alternative to directly inputting content.
Parameters
Parameter
Description
Status Code
A drop-down menu for selecting the HTTP status code. Common options include 200 (OK), 201 (Created), 400 (Bad Request), 404 (Not Found), etc.
Body Content Type
A drop-down menu for selecting the MIME type of the response content. Includes types such as application/json, text/plain, text/html, and application/x-www-form-urlencoded.
Body Content
(Optional) A text field for specifying the response content directly. Ignored if Body Content File is provided.
Body Content File
(Optional) A file parameter that allows the user to specify a file whose contents will be used as the response body. If both content and file are specified, the file takes precedence.
Usage Notes
This transformer is particularly suited for creating response objects in data virtualization pipelines that simulate RESTful APIs.
The attribute names align with FME's internal representation of HTTP response objects for Data Virtualization compatibility.
If both Body Content and Body Content File are provided, the transformer will prioritize the file content.
Example Scenarios
Mock API Response: Return a static JSON object as a virtualized API response using Status Code: 200 and Body Content Type: application/json.
Error Simulation: Configure a 404 response with an HTML body explaining the error using Body Content Type: text/html.
Would you like to know more? Click here to find out more details!