OSRS Plugin API
    Preparing search index...

    Function request

    • Function for handling making a GET or POST HTTP request, with specifiable parameters and types.

      Parameters

      • targetURL: string

        url to make a request to.

      • requestStyle: RequestType

        RequestType indicating if this request is a POST or GET request.

      • OptionalqueryParams: []

        parameters to include at the end of the URL.

      • Optionalheader: []

        table of key-values to add to the header of the request.

      • Optionalcallback: Function

        callback to run after the request is completed.

      • OptionaldataType: BodyType

        BodyType for the provided body data.

      • Optionalbody: []

        table of key-values to be passsed into the body of the request.

      Returns void

      osrs.HTTP.request(
      WEB_URL,
      osrs.HTTP.RequestType.GET,
      {},
      {},
      function(responseData, responseType, responseCode)
      osrs.print("Response code: " .. tostring(responseCode))
      osrs.print("Response type: " .. tostring(responseType))
      osrs.print("Response data: " .. tostring(responseData))
      end,
      osrs.HTTP.BodyType.NONE,
      {}
      )