-
-
Notifications
You must be signed in to change notification settings - Fork 17
OSL ‐ Http
https://osl.mistium.com/methods/networking
DO NOT USE THE OLD COMMANDS SYNTAX, everything that these commands used to do can now be done simpler and easier with methods
Send to a discord webhook through osl
http "new"
http "method" "POST"
http "type" "application/json"
body = {}
body.key("content") = ""
http "body" body
http "sendto" "https://discord.com/api/webhooks/"
Sends a complete HTTP request in a single line, specifying the method, body, and URL.
http "method" "body" "url"
Resets the current HTTP data, clearing any previously set values for method, type, body, and URL.
http "new"
Sets the currently used HTTP method for the request.
-
"get"
: HTTP GET method -
"post"
: HTTP POST method -
"put"
: HTTP PUT method -
"delete"
: HTTP DELETE method -
"patch"
: HTTP PATCH method - ... (other HTTP methods)
http "method" "get"
Sets the currently used headers for the request.
http "headers" {}
(v4.7.4 and above)
Gets the currently used headers for the request.
Returns as a json object
http "getheaders"
say data
(v4.7.4 and above)
Sets a single header key and value
http "setheader" "key" "value"
Sets the currently used request type or content type.
-
"text/plain"
: Plain text -
"application/json"
: JSON data -
"application/xml"
: XML data - ... (other content types)
http "type" "text/plain"
Sets the body content for the HTTP request.
- Specify the content of the request body.
http "body" "content goes here"
Sends the HTTP request to the specified URL.
- Provide the target URL where the request should be sent.
http "sendto" "https://example.com/api/resource"
response_code response_success response_failed response_error
Grabs the response from the website and sets the variable called "response" to the response value.
http "get_response"
if response != null (
if response_code == 404 (
say "404: Not Found"
) else (
if response_success (
say response
// Your code to run if there is a response
)
)
)
This command also sets response_error
Waits for a response from the website and sets the variable called "response" to the response value.
http "wait_response"
if response_code == 404 (
say "404: Not Found"
) else (
if response_success (
say response
// Your code to run if there is a response
)
)
This command also sets response_error
Note: These commands are designed to assist in making HTTP requests and handling responses in a scripted environment. Ensure proper error handling and security measures are implemented in a real-world scenario.
originOS is a web desktop gui with a self contained file system, programming languages, internet system and a whole lot of stuff an os should be able to do Use originOS here