Skip to content

Library: Rest

ᴏᴠ ━ ᴀɴɪꜱᴀ edited this page Dec 5, 2024 · 7 revisions

» Overview

Seeking a more streamlined, efficient, and user-friendly alternative to fetchRemote and callRemote to enhance your productivity? Consider transitioning to Assetify's REST module, where we handle it natively on your behalf! 😃

» Importing

Add the below code globally once in either of the shared .lua script of the resource you want to use within:

loadstring(exports.assetify_library:import("rest"))()

» APIs

  • assetify.rest:get() - shared

    Executes a GET request on specified URL.

    local promise: cPromise = assetify.rest:get(
       string: route, --Remote URL
       int: timeout, --Optional
       table: headers, --Optional
       table: credentials --Optional: Essentially required for protected requests
    )
  • assetify.rest:post() - shared

    Executes a POST request on specified URL.

    local promise: cPromise = assetify.rest:post(
       string: route, --Remote URL
       table: data,
       int: timeout, --Optional
       table: headers, --Optional
       table: credentials --Optional: Essentially required for protected requests
    )