Blueprint Reference

Blueprint Reference

Every node below lives under Mod HTTP in the Blueprint node palette, split into Mod HTTP > Request and Mod HTTP > Response.

Start Http Request

Starts an HTTP request and returns a handle to it. The handle is always valid, and may be ignored unless you need to cancel the request.

Sample

PinTypeDescription
URLStringThe address to request. Must be http or https, and its origin must be approved for your mod. Maximum 8000 characters.
VerbEModHttpVerbsThe HTTP method. Defaults to GET.
HeadersMap of String to StringRequest headers. Optional, and shown under Advanced. See Request headers.
StringContentStringRequest body, sent as UTF-8. Optional, shown under Advanced.
RawContentArray of ByteRequest body as raw bytes. Optional, shown under Advanced. Takes precedence if StringContent is also set.
OnSuccessDelegateFired with a UModHttpSuccessResult when a response arrives.
OnFailureDelegateFired with an FModHttpFailureResult when no response arrives, or the request was rejected.
TimeoutSecondsFloatHow long the whole request may take. Defaults to 30, clamped to 120. Optional, shown under Advanced. See Timeouts.
Request HandleUModHttpRequestReturn value. Always valid, including for a rejected request.

If you supply a body but no Content-Type header, one is added for you: text/plain; charset=utf-8 for StringContent, or application/octet-stream for RawContent.

Examples

POSTing some JSON to an endpoint, setting the Content-Type appropriately.

A post request containing a json payload.

Cancelling an in-flight request before it completes.

A request is cancelled before it has a chance to complete.

EModHttpVerbs

Valid values for HTTP verbs:

GET, HEAD, POST, PUT, PATCH, DELETE, QUERY.

OnSuccess means the server returned a response

OnSuccess fires whenever a response comes back, whatever its status code. A 404, a 500, and a 302 all arrive there. Check IsOK before you use the result, or read GetResponseCode and handle the codes you care about.

OnFailure means something more fundamental went wrong: the request was rejected before being sent, the connection failed, or the request was cancelled. See Failure Types.

Redirects are not followed

A 3xx response is delivered to OnSuccess like any other. If you want to follow it, read the Location header and call StartHttpRequest again yourself.

Timeouts

Every request has a deadline. TimeoutSeconds sets it and defaults to 30 seconds. It is clamped to at most 120, and to greater than zero, so there is no way to ask for no timeout at all. A value outside that range is clamped rather than refused, and a warning naming the clamped value is written to the log.

A request that runs past its deadline is abandoned and fires OnFailure with a failure type of TimedOut. Whether the server ever saw it is unknown, so only retry if the request is safe to repeat. A GET usually is. A POST that creates something usually is not.

Ordering

Your callback never runs before StartHttpRequest has returned the handle to you, even when the request is rejected outright or the response is already available. It is always safe to store the handle first and use it from the callback.

Delivery can also be delayed by a frame or so when a response arrives at a moment the Blueprint VM cannot be entered. Do not assume a response arrives on any particular frame.

Request headers

Header names must be valid HTTP tokens: letters, digits, and ! # $ % & ' * + - . ^ _ ` | ~.

Header values must be non-empty, printable ASCII, with horizontal tab allowed. Control characters and bytes at or above 0x7F are rejected. An empty value is rejected rather than sent, because the HTTP stack would silently drop the header and leave you believing you had set it.

Reserved headers

These are set by the game and cannot be supplied by a mod:

Host, Content-Length, Transfer-Encoding, TE, Trailer, Expect, Connection, Proxy-Connection, Keep-Alive, Upgrade, Proxy-Authorization, User-Agent, X-Request-Id

Sending one fails the request with BlockedByPolicy rather than being silently ignored, so you find out at the call rather than from the far end’s behaviour.

URL rules

Beyond needing an approved origin, a URL must:

  • use the http or https scheme
  • carry no embedded credentials — https://user:pass@host/ is rejected
  • be printable ASCII with no whitespace, control characters, or backslashes. Percent-encode anything else with UrlEncode
  • be at most 8000 characters

A URL that breaks any of these fails with InvalidArguments, except for the scheme and credential rules, which fail with BlockedByPolicy.

Which mod a request is attributed to

A request is checked against the approved origins of the mod that made it, worked out by walking the Blueprint call stack and taking the outermost mod on it. Base-game frames are ignored.

So if your mod calls into a Blueprint belonging to another mod, and that Blueprint starts a request, the request is attributed to your mod and checked against your approved origins. A shared helper mod cannot make requests on your behalf under its own permissions. Every mod that calls it has to declare the origins itself and have them approved.

Request Handle

Cancel

Call Cancel on the Request Handle to drop a request that is still in-flight. It is safe to call, and does nothing, if it has already completed or was rejected.

A cancelled request still fires OnFailure, with a failure type of Cancelled. Requests still outstanding when the game shuts down are cancelled the same way.

RequestID

A read-only String on the Request Handle, unique to this request.

It is also sent to the server as the X-Request-Id header, and appears in the game’s logs. If you need to correlate something a player reports with an entry in your own server logs, this is the value to use.

Success Response

Your OnSuccess event is given a UModHttpSuccessResult object, which has the following available functions:

Set of functions available on UModHttpSuccessResult

FunctionReturnsDescription
GetAllHeadersMap of String to StringAll response headers, keyed by name.
GetHeaderStringThe value of one response header by name, or an empty string if it was not present.
GetResponseCodeIntegerThe HTTP status code.
IsOKBooleanTrue if the response code is a typical success code (200 to 206 inclusive). A shortcut for the usual defintion of “successful request”.
GetContentAsStringStringThe response body, interpreted as UTF-8.
GetContentArray of ByteThe response body as raw bytes.

Header names are matched case-insensitively by both GetHeader and the map from GetAllHeaders.

Failure Response

Your OnFailure event is given a FModHttpFailureResult struct, which has the following properties:

PropertyTypeDescription
FailureTypeEModHttpFailureTypeWhy the request failed.
ErrorInfoTextHuman-readable detail. May be empty.

Failure Types

You may want to branch on FailureType to retry a request, or surface an error to the player. ErrorInfo may provide additional information for logging and diagnostics, not for parsing.

ValueWhat happenedWhat to do
InvalidArgumentsThe call was malformed (a bad or over-long URL, an unknown verb, or a header whose name or value is not well formed)Fix the call. Check ErrorInfo for which part was rejected.
NotApprovedByPlayerThe URL’s origin is not approved for your mod.Usually an exact-match problem: a subdomain, a port, or http versus https. Check the origin against what you declared, then handle the refusal — see Requesting Permissions.
BlockedByPolicyNot permitted by the system. The URL is not http(s) or carries credentials, or a reserved header was supplied.Check ErrorInfo for more details, and fix the call.
ConnectionErrorThe request never got a response.Nothing to fix in the mod. The network or the server is unreachable. Retry with backoff if it makes sense, and fail gracefully if not.
CancelledYour mod called Cancel, or the game cancelled the request while shutting down.Normally expected. Do not treat it as an error.
TimedOutThe request ran past its timeout and was abandoned.Retry only if the request is safe to repeat, as the server may or may not have seen it. See Timeouts.

A response that arrives with an error status is not a failure at this level. It goes to OnSuccess, where you read it back with IsOK and GetResponseCode.

URL helpers

NodeDescription
UrlEncodePercent-encodes a string. Everything outside the unreserved set is encoded, so a space becomes %20.
UrlDecodeReverses UrlEncode, non-ASCII included.
MakeUrlQueryStringBuilds an encoded query string from an array of FModHttpQueryParam.
MakeFormBodyBuilds an application/x-www-form-urlencoded request body from an array of FModHttpQueryParam.

UrlEncode, UrlDecode, and MakeUrlQueryString do not use the HTML form convention where + means a space. A space becomes %20. MakeFormBody is the one that uses the form convention.

MakeUrlQueryString takes an array rather than a map so that parameters keep the order you wrote them in and a field name may repeat. For example, given an array with entries ("field1", "Value With Space"), ("field1", "anothervalue"), ("field2", "some/path") it returns:

field1=Value%20With%20Space&field1=anothervalue&field2=some%2Fpath

It returns only the query string itself, with no leading ?.

MakeFormBody

MakeFormBody takes the same array and produces a request body instead of a query string. The encoding is the same except that a space becomes +, so the entries above give:

field1=Value+With+Space&field1=anothervalue&field2=some%2Fpath

Pass the result as StringContent, and set a Content-Type header of application/x-www-form-urlencoded yourself. Without that header the body goes out as text/plain; charset=utf-8 and the far end will not read it as a form.

FModHttpQueryParam

A query string entry given to MakeUrlQueryString.

PropertyTypeDescription
FieldStringQuery string parameter name.
ValueStringQuery string parameter value.
Last updated on