Webrequest
Summary
Functions to call remote websites or APIs
Class Methods
WebRequest:Get(url, onSuccess, onError, headers, context)
Sends a GET request to the given URL
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
url | string | The URL to send the request to | |
onSuccess | function | A function to call when the request succeeds | |
onError | function | A function to call when the request fails | |
headers | table | A table of key-value pairs to send as headers | |
context | table | A value to pass to the onSuccess and onError functions |
Example
WebRequest:Post(url, postData, onSuccess, onError, headers, context)
Sends a POST request to the given URL with the given data
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
url | string | The URL to send the request to | |
postData | table | A table of key-value pairs to send as POST data | |
onSuccess | function | A function to call when the request succeeds | |
onError | function | A function to call when the request fails | |
headers | table | A table of key-value pairs to send as headers | |
context | table | A value to pass to the onSuccess and onError functions |
Example
Last updated