EFFECTS

Asynchronous HTTP/S request

Executes a request with the specified method to the specified site using the specified headers and the specified request body. Returns the code and the body of the response.

[async[hronously]] request [%string%] to [url] %string% [with header[s] %request properties%] [(and|with) body %string%] [and store [[the] (body|result) in %object%] [and] [code in %object%]]
async request "GET" to url "https://crewpvp.xyz" and store the result in {_data} and code in {_code}

An asynchronous request cannot be used in functions where a value is returned. The result of an asynchronous request in this case will be <none>.

function asyncRequest() :: string:
    async request "GET" to url "https://crewpvp.xyz" and store the result in {_data} and code in {_code}
    return "{_data};{_code}"

command /asyncRequest:
    trigger:
        set {_result} to asyncRequest()
        send "{_result}" to player

Running the command /asyncRequest will return <none> instead of the expected result.

Synchronous HTTP/S request

Executes a request with the specified method to the specified site using the specified headers and the specified request body. Unlike asynchronous requests, this operation blocks the main thread until the response is received, which can lead to application unresponsiveness. Use synchronous requests only when blocking behavior is acceptable or necessary.

sync[hronously] request [%string%] to [url] %string% [with header[s] %request properties%] [(and|with) body %string%] [and store [[the] (body|result) in %object%] [and] [code in %object%]]

Blocking the main thread for the duration of the request can cause application unresponsiveness. Use this option wisely to avoid negatively impacting the user experience.