OSRS Plugin API
    Preparing search index...

    Enumeration BodyType

    Format for body data.

    Index

    Enumeration Members

    Enumeration Members

    FORMDATA: number

    Sends a request with a Content-Type of 'multipart/form-data'.

    osrs.HTTP.request(
    WEB_URL,
    osrs.HTTP.RequestType.POST,
    {},
    {
    ["User-Agent"] = "osclient",
    },
    function(responseData, responseType, responseCode)
    if responseCode >= 200 and responseCode < 300 then
    osrs.print("Received a successful response from our request!")
    end
    end,
    osrs.HTTP.BodyType.FORMDATA,
    {
    ["data"] = "data",
    ["level"] = "99"
    }
    )
    JSON: number

    Sends a request with a Content-Type of 'application/json'. Include the raw JSON string in the body by assigning it to the "json" key in the body table.

    local jsonData
    osrs.HTTP.request(
    WEB_URL,
    osrs.HTTP.RequestType.POST,
    {},
    {
    ["User-Agent"] = "osclient",
    },
    function(responseData, responseType, responseCode)
    if responseCode >= 200 and responseCode < 300 then
    osrs.print("Successfully submitted data to the server!")
    end
    end,
    osrs.HTTP.BodyType.JSON,
    {
    ["json"] = tostring(jsonData)
    }
    )
    URLENCODED: number

    Sends a request with a Content-Type of 'application/x-www-form-urlencoded'.

    osrs.HTTP.request(
    WEB_URL,
    osrs.HTTP.RequestType.POST,
    {},
    {
    ["User-Agent"] = "osclient",
    },
    function(responseData, responseType, responseCode)
    if responseCode >= 200 and responseCode < 300 then
    osrs.print("Received a successful response from our request!")
    end
    end,
    osrs.HTTP.BodyType.URLENCODED,
    {
    ["data"] = "data",
    ["level"] = "99"
    }
    )