HTTP Endpoint

Use the HTTP endpoint page when the workflow starts with or ends at an HTTP request. It explains how LoadStrike treats HTTP as a source, a destination, or both.

What this page helps you do

What this page helps you do

Use the HTTP endpoint page when the workflow starts with or ends at an HTTP request. It explains how LoadStrike treats HTTP as a source, a destination, or both.

Who this is for

Teams defining the transport-specific source or destination side of a correlated transaction.

Prerequisites

  • A stable tracking field shared between the producer side and the consumer or completion side

By the end

A transport definition that matches the transaction you need to measure.

Use this page when

Use this page when HTTP Endpoint is the source or destination side of the transaction and you need the documented endpoint fields before wiring the scenario.

Visual guide

Decision diagram showing plain HTTP steps, tracked endpoints, and browser flows.
Choose the protocol path that matches where the transaction starts and which part of the system proves completion.

Guide

Produce and Consume

HTTP can be used as the source that starts the workflow or as the destination that confirms it. Both produce and consume contracts require an absolute URL.

Auth

HTTP supports Basic, Bearer, and OAuth2 client credentials. For Basic auth, username is required and password may be empty, but null is rejected. TokenHeaderName defaults to Authorization and can be changed when the target expects the auth value in another request header.

Tracking vs Response Shape

TrackingPayloadSource decides where LoadStrike reads the tracked id from. ResponseSource decides which payload shape is kept after the HTTP call completes. In practice, TrackingPayloadSource is about correlation, while ResponseSource is about what the produced HTTP payload contains.

Advanced HTTP Fields

Use RequestTimeout to control request duration, ConsumePoll for code-driven consume loops, ConsumeArrayPath when the tracked array is nested under a JSON property, and ConsumeJsonArrayResponse when the response itself is the array. If both array options are set, ConsumeArrayPath wins.

OAuth2 Client Credentials Fields

For the common case, set TokenUrl, ClientId, ClientSecret, optional Scope or Scopes, optional Audience, and optional AdditionalFormFields directly on Auth. You can also use the nested OAuth2ClientCredentials object when you prefer grouped settings. If both are supplied, the top-level Auth fields win. TokenRequestHeaders adds headers only to the token call, while TokenHeaderName changes which header on the main business request receives the Basic or Bearer value.

Endpoint definition samples

Use these samples to see how HTTP Endpoint is represented as a source or destination endpoint before you attach it to a correlated scenario.

If you run these examples locally, add a valid runner key before execution starts. Set it with WithRunnerKey("...") or the config key LoadStrike:RunnerKey.

HTTP Endpoint

using LoadStrike;

var source = new HttpEndpointDefinition
{
    Name = "orders-api",
    Mode = TrafficEndpointMode.Produce,
    TrackingField = TrackingFieldSelector.Parse("json:$.trackingId"),
    Url = "https://api.example.com/orders",
    Method = "POST",
    BodyType = HttpRequestBodyType.Json,
    TrackingPayloadSource = HttpTrackingPayloadSource.Response,
    ResponseSource = HttpResponseSource.ResponseBody,
    TokenRequestHeaders = new Dictionary<string, string>(StringComparer.Ordinal)
    {
        ["X-Tenant"] = "northwind"
    },
    Auth = new HttpAuthOptions
    {
        Type = HttpAuthType.OAuth2ClientCredentials,
        TokenUrl = "https://auth.example.com/oauth/token",
        ClientId = "orders-client",
        ClientSecret = "orders-secret",
        Scope = "orders.write",
        Audience = "orders-api",
        TokenHeaderName = "X-Orders-Token"
    },
    MessagePayload = new { orderId = "ord-1001", amount = 49.95m }
};

var destination = new HttpEndpointDefinition
{
    Name = "orders-events",
    Mode = TrafficEndpointMode.Consume,
    TrackingField = TrackingFieldSelector.Parse("json:$.trackingId"),
    Url = "https://api.example.com/order-events",
    Method = "GET",
    ConsumeArrayPath = "$.items",
    PollInterval = TimeSpan.FromMilliseconds(250)
};

var tracking = new CrossPlatformTrackingConfiguration
{
    RunMode = TrackingRunMode.GenerateAndCorrelate,
    Source = source,
    Destination = destination
};

var scenario = LoadStrikeScenario.Empty("http-order-flow")
    .WithoutWarmUp()
    .WithLoadSimulations(LoadStrikeSimulation.Inject(5, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(20)))
    .WithCrossPlatformTracking(tracking);

LoadStrikeRunner.RegisterScenarios(scenario)
    .WithRunnerKey("rkl_your_local_runner_key")
    .Run();

HTTP endpoint fields and parameters

Name

Required endpoint identifier. It appears in correlation tables, sink exports, and troubleshooting messages, so choose a stable descriptive name.

Mode

Choose Produce when LoadStrike should create traffic, or Consume when it should listen for downstream traffic. Run mode validation checks that the selected mode matches the source or destination role.

TrackingField

Selector that extracts the correlation id from a header or JSON body. It is normally required, but can be omitted when UseLoadStrikeTraceIdHeader is true so LoadStrike uses header:loadstrike-trace-id for generated source traffic. Selector prefixes such as header: and json: are parsed case-insensitively, but the header name or JSON path segments after the prefix must match exact casing. The extracted value is matched case-sensitively by default unless TrackingFieldValueCaseSensitive is turned off on the tracking configuration.

GatherByField

Optional destination-only selector used for grouped correlation reports. It follows the same selector-casing rules as TrackingField. Group values are grouped case-sensitively by default unless GatherByFieldValueCaseSensitive is turned off on the tracking configuration.

AutoGenerateTrackingIdWhenMissing

Defaults to true. When the source payload does not already contain the tracked id, LoadStrike can inject one so the generated traffic still produces a correlation key.

UseLoadStrikeTraceIdHeader

Defaults to false. When true and TrackingField is omitted, produced source messages receive a loadstrike-trace-id header with a GUID value. Consume-mode source endpoints and CorrelateExistingTraffic runs do not inject this header; they only observe it if the existing traffic already contains it.

PollInterval

Controls how often a consumer-style endpoint polls for new messages. The value must stay greater than zero whenever you set it explicitly.

MessageHeaders

Optional headers that are written with produced traffic and also influence tracking extraction when the selector targets headers. Header names are preserved exactly as you set them, and header selectors later match using that same exact casing.

MessagePayload

Optional object or body value sent by producer-style endpoints. This is the payload your scenario is actually placing on the wire.

MessagePayloadType

Optional type hint used when JSON selectors need typed parsing. Leave it unset when dynamic JSON parsing is enough.

JsonSettings / JsonConvertSettings

Optional serializer settings for System.Text.Json or Newtonsoft.Json. Use them only when the payload shape or naming strategy requires custom parsing behavior.

ContentType

Optional explicit content type for custom payload handling. This is most helpful for delegate-style transports or non-default HTTP body shapes.

Url

Required absolute URI for the HTTP target. LoadStrike rejects non-absolute URLs during endpoint validation.

Method

HTTP verb used for the request or poll call, such as GET or POST. Keep it aligned with how the target endpoint actually behaves.

BodyType

Select Json, PlainText, Xml, FormUrlEncoded, or Binary so the runtime builds the request body correctly.

ConsumePoll

Optional async code callback for consume mode when the SDK should fetch the next tracked payload itself instead of issuing the built-in HTTP request. Use it for custom polling logic, but keep Url configured so the endpoint definition still stays self-describing.

ResponseSource

Controls which response data becomes the produced TrackingPayload. Use None to keep the request payload, ResponseBody to keep the parsed response body, ResponseHeaders to merge response headers onto the request payload, or ResponseStatusCode to keep a small status object.

RequestTimeout

Per-request timeout for the HTTP adapter. It must be a positive duration whenever you set it explicitly.

TrackingPayloadSource

Choose whether tracking extraction reads the request payload or the response payload. Request is the default. When you switch to Response and leave ResponseSource unset, the runtime keeps response-body compatibility behavior so response tracking can still resolve from the returned body.

ConsumeArrayPath

Optional JSON path that selects the array to inspect in a consume-mode HTTP response, such as $.items. Use it when the tracked messages are nested under a property instead of being the root response array.

ConsumeJsonArrayResponse

Enable this when a consumer-style HTTP poll returns a root JSON array and each array item should be inspected as a candidate tracked message. If ConsumeArrayPath is also set, the path wins.

TokenRequestHeaders

Optional headers added only to the OAuth2 client-credentials token request. Use them when the token server needs tenant, region, or gateway headers that should not be sent to the main business request.

Auth.Type

Supported values are None, Basic, Bearer, and OAuth2ClientCredentials. The runtime validates that the matching auth fields are populated.

Auth.Username / Auth.Password

Required together for Basic auth. Username without a password is rejected.

Auth.BearerToken / Auth.TokenHeaderName

BearerToken is required for Bearer auth. TokenHeaderName defaults to Authorization and changes which request header receives the Basic or Bearer value for Basic, Bearer, and OAuth2 client-credentials auth.

Auth.TokenUrl / Auth.ClientId / Auth.ClientSecret

Top-level OAuth2 client-credentials fields. Use these for the common case when you want one flat auth object instead of nesting another options block.

Auth.Scope / Auth.Scopes / Auth.Audience

Scope sends one scope string, Scopes sends a list that becomes one space-separated scope value, and Audience adds the optional audience field to the token request. If Scope is set, it wins over any Scopes list.

Auth.AdditionalFormFields

Optional extra token form fields such as resource, tenant, or custom identity-provider parameters.

Auth.OAuth2ClientCredentials

Optional nested OAuth2 client-credentials object with TokenEndpoint, ClientId, ClientSecret, optional Scopes, and optional AdditionalFormFields. It is useful when you want auth settings grouped together, but if both top-level auth fields and the nested object are set, the top-level auth fields win.

{ "items": [{ "trackingId": "ord-1001", "status": "accepted" }] }