Skip to content

API UO HTTP_Post en

Codex edited this page Oct 3, 2026 · 1 revision

UO.HTTP_Post

Русский · English · Українська · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

UO.HTTP_Get · UO.HTTP_Post · UO.HTTP_Body · UO.HTTP_Header

ClassicUO • Runtime API

Sends text to your HTTP service using POST and returns its response text. A script can report a stopped route. This is not a ready-made Telegram/Discord command: their protocol, authentication and request format require separate support.

Exact syntax

UO.HTTP_Post(URL:Any, PostData:Any) -> Any

Parameters

  • URL — Required String: an absolute http:// or https:// address. Replace example.com with your service. No game connection is required; the process uses its normal network connection, not the profile's game proxy.
  • PostData — Required request-body String. Sent as UTF-8 with Content-Type: text/plain; charset=utf-8. No automatic form encoding or application/json header. JsonStringify creates text only: the example service must accept JSON as text/plain. These commands cannot set arbitrary request headers.

Returns

String — response text, also stored for HTTP_Body(). Neither a Boolean nor an HTTP status. An empty string does not prove failure; a nonempty string does not prove the server operation succeeded.

Behavior

  • The last response belongs to the current script runtime. Its next GET/POST replaces it; other concurrent scripts do not. It is not saved in the profile. Copy body and headers to local variables before another request if needed.
  • GET/POST wait in the executing script thread. One 20-second deadline covers the request and body read. Stopping the script cancels the wait; HTTP_Body/HTTP_Header never wait. The whole response is buffered in memory even with File; this is not streaming for large downloads.
  • Response charset controls text decoding; missing/unknown charset falls back to UTF-8. HTTP 4xx/5xx bodies are read too. A network failure/timeout logs an error and empties body and headers; Try/Catch does not replace checking the expected response. Script cancellation propagates. Local file-write or argument errors may be caught by Try/Catch.
  • POST updates body and headers and returns that same body string. Do not automatically retry POST solely because its response is empty: the server may already have performed the action. The examples' accepted/status checks are your service's contract, not built-in HTTP success flags.

Internal functions: from call to result

These are actual client stages, not extra UO commands. GET/POST call HttpRequest; HTTP_Body/HTTP_Header only read its result within their runtime.

1. ExecuteClientApiCompatibility

POST updates body and headers and returns that same body string. Do not automatically retry POST solely because its response is empty: the server may already have performed the action. The examples' accepted/status checks are your service's contract, not built-in HTTP success flags.

String — response text, also stored for HTTP_Body(). Neither a Boolean nor an HTTP status. An empty string does not prove failure; a nonempty string does not prove the server operation succeeded.

Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApiUO.cs; function ExecuteClientApiCompatibility.

2. HttpRequest

GET/POST wait in the executing script thread. One 20-second deadline covers the request and body read. Stopping the script cancels the wait; HTTP_Body/HTTP_Header never wait. The whole response is buffered in memory even with File; this is not streaming for large downloads.

Response charset controls text decoding; missing/unknown charset falls back to UTF-8. HTTP 4xx/5xx bodies are read too. A network failure/timeout logs an error and empties body and headers; Try/Catch does not replace checking the expected response. Script cancellation propagates. Local file-write or argument errors may be caught by Try/Catch.

Project source: src/ClassicUO.Client/Game/Managers/ClassicUOInjectionApiBridge.cs; function HttpRequest.

These are actual client stages, not extra UO commands. GET/POST call HttpRequest; HTTP_Body/HTTP_Header only read its result within their runtime.

Examples

Check an agreed service response

# Check an agreed service response
#
# Sends text to your HTTP service using POST and returns its response text. A script can report
# a stopped route. This is not a ready-made Telegram/Discord command: their protocol,
# authentication and request format require separate support.
#
# String — response text, also stored for HTTP_Body(). Neither a Boolean nor an HTTP status. An
# empty string does not prove failure; a nonempty string does not prove the server operation
# succeeded.

SUB Main()
    # Your service accepts Route stopped and responds with accepted by agreement. Main returns True
    # only for that text. It checks your application protocol, not the HTTP status.
    # The example.com URLs are illustrative and do not provide this service. Replace them with your
    # endpoints; running an example performs real HTTP requests. No game actions are performed.

    Dim reply = UO.HTTP_Post("https://example.com/basic-event", "Route stopped")
    Return Trim(reply) = "accepted"
END SUB

Parameter and execution notes:

  • Your service accepts Route stopped and responds with accepted by agreement. Main returns True only for that text. It checks your application protocol, not the HTTP status.
  • The example.com URLs are illustrative and do not provide this service. Replace them with your endpoints; running an example performs real HTTP requests. No game actions are performed.

Send a structured report

# Send a structured report
#
# Sends text to your HTTP service using POST and returns its response text. A script can report
# a stopped route. This is not a ready-made Telegram/Discord command: their protocol,
# authentication and request format require separate support.
#
# String — response text, also stored for HTTP_Body(). Neither a Boolean nor an HTTP status. An
# empty string does not prove failure; a nonempty string does not prove the server operation
# succeeded.

SUB Main()
    # JsonStringify escapes the newline into JSON text. Content-Type remains text/plain. The
    # response must be a JSON object: status is returned, missing status gives unknown, and
    # parse/type failure gives invalid response.
    # The example.com URLs are illustrative and do not provide this service. Replace them with your
    # endpoints; running an example performs real HTTP requests. No game actions are performed.

    Dim report = Dictionary()
    report["event"] = "route-stopped"
    report["text"] = "line one" & Chr(10) & "line two"
    Dim reply = UO.HTTP_Post("https://example.com/basic-report", JsonStringify(report))
    Try
        Dim result = JsonParse(reply)
        Return result.Get("status", "unknown")
    Catch problem
        Return "invalid response"
    End Try
END SUB

Parameter and execution notes:

  • JsonStringify escapes the newline into JSON text. Content-Type remains text/plain. The response must be a JSON object: status is returned, missing status gives unknown, and parse/type failure gives invalid response.
  • The example.com URLs are illustrative and do not provide this service. Replace them with your endpoints; running an example performs real HTTP requests. No game actions are performed.

Keep a response before another request

# Keep a response before another request
#
# Sends text to your HTTP service using POST and returns its response text. A script can report
# a stopped route. This is not a ready-made Telegram/Discord command: their protocol,
# authentication and request format require separate support.
#
# String — response text, also stored for HTTP_Body(). Neither a Boolean nor an HTTP status. An
# empty string does not prove failure; a nonempty string does not prove the server operation
# succeeded.

SUB Main()
    # firstReply and firstHeaders retain the POST response. The next GET replaces the internal
    # buffers but not those local variables.
    # The example.com URLs are illustrative and do not provide this service. Replace them with your
    # endpoints; running an example performs real HTTP requests. No game actions are performed.

    Dim firstReply = UO.HTTP_Post("https://example.com/basic-event", "Route stopped")
    Dim firstHeaders = UO.HTTP_Header()
    UO.HTTP_Get("https://example.com/basic-status")
    Return firstReply & "|" & firstHeaders
END SUB

Parameter and execution notes:

  • firstReply and firstHeaders retain the POST response. The next GET replaces the internal buffers but not those local variables.
  • The example.com URLs are illustrative and do not provide this service. Replace them with your endpoints; running an example performs real HTTP requests. No game actions are performed.

Clone this wiki locally