• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • Globals

    HTTPResponse

    Methods

    GetBody

    ServerOnly

    Returns the raw response body as a string, or nil if the body is empty.

    Returns

    string

    GetHeaders

    ServerOnly

    Returns the response headers as a table mapping header names to values.

    GetJSONBody

    ServerOnly

    Parses the response body as JSON and returns the decoded Lua value (typically a table). Returns nil if the body is empty; raises an error if the body is not valid JSON.

    By default, JSON null values decode to the global JSONNull sentinel so that keys with null values are preserved in decoded tables (a nil value would delete the key). Pass false for decodeNull to decode JSON null as nil instead. Compare against JSONNull, or use type(value) checks, when reading fields that may be null.

    local data = response:GetJSONBody()
    if type(data.tickets_total) == "number" then
        print("Total tickets: " .. data.tickets_total)
    end
    

    Parameters

    decodeNull
    boolean
    optional

    Returns

    any

    GetStatusCode

    ServerOnly

    Returns the HTTP status code of the response (e.g. 200, 404).

    Returns

    number
    PocketWorlds Icon

    © 2026 Pocket Worlds. All rights reserved.