• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • Globals

    HTTPRequest

    Methods

    SetBody

    ServerOnly

    Sets the raw request body string. Returns the request, so calls can be chained.

    Parameters

    body
    string

    SetHeader

    ServerOnly

    Sets a request header, replacing any previous value for the same name. Passing nil or an empty string as the value removes the header. Returns the request, so calls can be chained.

    request:SetHeader("Content-Type", "application/json")
    request:SetHeader("x-api-key", apiKey)
    

    Parameters

    name
    string
    value
    string

    SetJSONBody

    ServerOnly

    Encodes the given Lua value (typically a table) as JSON and sets it as the request body. Returns the request, so calls can be chained.

    Tables with consecutive integer keys starting at 1 encode as JSON arrays; all other tables encode as JSON objects. Note that an EMPTY table encodes as an empty JSON object (), never as an empty array. Use the global JSONNull to encode an explicit JSON null (a nil table value would simply omit the key).

    request:SetJSONBody({
        grants = {
            { user_id = player.user.id, tickets = 5 },
        },
        event_id = JSONNull, -- encodes as null
    })
    

    Parameters

    value
    any

    Sets a URL query parameter, replacing any previous value for the same name. Passing nil or an empty string as the value removes the parameter. Returns the request, so calls can be chained.

    request:SetQueryParameter("user_id", player.user.id)
    

    Parameters

    name
    string
    value
    string
    PocketWorlds Icon

    © 2026 Pocket Worlds. All rights reserved.