HTTP Workflow Request and Response v2

An HTTP Workflow uses one root receive Step and exactly one matching root respond Step. The receive shape controls body parsing; the respond shape controls serialization.

Request shapes

Receive Method Body value
HttpReceiveStream Raw request Stream.
HttpReceiveJsonObject Parsed JSON object or null. Invalid JSON fails at the receive Step.
HttpReceiveJsonArray Deferred sequence of JSON items. Parsing starts far enough to report an invalid root or first item at the receive Step, then continues lazily.

All receive Methods return:

  • Uri — the request URI supplied by the runtime context.
  • Headers — a case-insensitive string dictionary.
  • Parameters — route and query values resolved by routing.
  • Body — the shape selected above.

The authored Method must be uppercase and one of GET, HEAD, POST, PUT, DELETE, OPTIONS, PATCH, TRACE, or CONNECT.

UriTemplate must start with one /, remain relative, contain no whitespace or fragment, and use balanced non-empty placeholders such as /orders/{orderId}. It can include a query template.

Response shapes

Every respond Method accepts:

  • StatusCode, which defaults to 200.
  • Headers, a string dictionary for application response headers.
  • Body, whose type depends on the Method.

The Stream respond Method sends a raw Stream. The JSON object Method serializes an object. The JSON array Method serializes a deferred sequence as a JSON array and can stream items as they are consumed. JSON Methods add application/json; charset=utf-8 when you did not supply a content type.

Put the respond Step at the Workflow root. Nested-only, missing, or duplicate respond Steps fail validation. Use containers to calculate response data, then map the final values into the one root respond Step.

Errors and cancellation

Validate caller input before mutation and map deliberate client failures to an appropriate status and structured body. An unhandled Workflow exception is handled by the transport and may not have your domain response shape.

Authorization and CORS

The Environment hostname selects the Environment. The API Key must authorize that Environment and Workflow.

Flowgear owns CORS headers from the Environment's AllowedOrigins. Do not author Access-Control-* headers in the Workflow response.

Match the Method pair

Use HttpReceiveStream with HttpRespondStream, HttpReceiveJsonObject with HttpRespondJsonObject, or HttpReceiveJsonArray with HttpRespondJsonArray. The HTTP Node reference lists each Method's exact Parameters and Returns.

See also

See Publish a Workflow as an HTTP Endpoint, Token Authentication, and CORS and Allowed Origins.