sb0t scripts can make outbound HTTP requests using the constructableDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AresChat/sb0t/llms.txt
Use this file to discover all available pages before exploring further.
HttpRequest object, enabling scripts to call external APIs, fetch data feeds, post webhook notifications, or retrieve content from the web. Requests run on a background thread and invoke a callback when the response arrives.
Responses are enqueued and the
oncomplete callback is invoked on the main server processing thread, so callback code runs safely alongside other script events. However, particularly slow or hung remote servers may cause the background thread to linger — keep external dependencies reliable.Creating an HttpRequest
Usenew HttpRequest() to create an instance, configure its properties, and call download() to begin the request.
HttpRequest Instance Properties
The full URL of the request target (e.g.
"https://example.com/api/endpoint").The HTTP method to use. Accepted values (case-insensitive):
"GET" or "POST". Defaults to "get".The POST body payload. Only sent when
method is "POST". Encoded using UTF-8 if utf is true, otherwise using the system default encoding. The Content-Type is set to application/x-www-form-urlencoded automatically.Sets the HTTP
Accept request header (e.g. "application/json"). Optional.Sets the
User-Agent request header. Defaults to an empty string.Overrides the HTTP
Host header. Optional — leave unset to use the host derived from src.When
true, the POST body (params) is encoded as UTF-8 and the response body is decoded as UTF-8. When false, the system default encoding is used. Defaults to false.The callback function invoked when the request completes. Receives a single
HttpRequestResult argument. Set this before calling download().HttpRequest Instance Methods
request.header(key, value)
Sets a custom HTTP request header. Call this before download(). Can be called multiple times for multiple headers.
The header name (e.g.
"Authorization").The header value (e.g.
"Bearer my-token").boolean — true if the header was set, false if either argument is undefined.
request.download(arg?)
Initiates the HTTP request on a background thread. The instance can only process one request at a time — calling download() while a request is in progress returns false immediately.
An optional arbitrary string passed through to the
HttpRequestResult.arg property in the callback. Useful for identifying which request triggered the callback when sharing one handler across multiple requests.boolean — true if the request was started, false if the instance is already busy.
HttpRequestResult Object
Theoncomplete callback receives an HttpRequestResult object as its sole argument:
The full response body as a string. Decoded using UTF-8 if
utf was true on the request, otherwise using the system default encoding. Empty string if the request failed.The optional argument string passed to
download(). Useful for correlating responses to specific requests.Examples
XmlParser — XML Document Object
XmlParser is a constructable object for loading and navigating XML documents. Use it to parse the response body returned by HttpRequest into a traversable node tree. It wraps the .NET XmlDocument API and surfaces Node, NodeCollection, and NodeAttributes objects.
Creating an XmlParser
XmlParser Instance Properties
true if an XML document has been successfully loaded or created and is ready to traverse. false before load() or create() is called, or after a failed parse.Returns the current XML document as a formatted (indented) UTF-8 string. Returns
null if available is false or serialization fails.The name of the document root node. Returns
null if available is false.The inner text content of the entire document. Assignable. Returns
null if available is false.The parent
Node of the document root, or null if there is none.A
NodeCollection of the document’s top-level child elements. Returns null if there are none or if available is false.A
NodeAttributes collection for the document root’s XML attributes. Returns null if unavailable.XmlParser Instance Methods
parser.load(xmlString)
Parses an XML string and makes the document available for traversal.
A valid XML string to parse.
boolean — true on success, false if parsing fails.
parser.create(rootTagName)
Creates a new empty XML document with a single root element and an XML declaration.
The tag name for the root element.
boolean — true on success.
parser.getNodesByName(tagName)
Searches the entire document for all elements with a given tag name.
The element tag name to search for.
NodeCollection — the matching nodes, or null if none were found.
parser.appendChild(tagName)
Creates and appends a new child element directly under the document root element.
The tag name for the new element.
Node — the newly created child node, or null on error.
parser.removeChild(node)
Removes a direct child Node from the document root element.
The child
Node instance to remove.boolean — true on success.
Node Object
ANode represents a single XML element returned by traversal operations (childNodes, getNodesByName(), etc.).
The tag name of the XML element (e.g.
"item", "title").The inner text content of the element. Can be assigned to update the node’s text in the underlying XML document.
The parent
Node of this element, or null if this is the root.A
NodeCollection of child elements (excludes text/comment nodes that begin with #). Returns null if there are no child elements.A
NodeAttributes collection for this element’s XML attributes. Returns null if there are no attributes.node.getNodesByName(tagName)
Searches for all descendant elements with a given tag name.
The element tag name to search for.
NodeCollection — the matching nodes, or null if none were found.
node.appendChild(tagName)
Creates and appends a new child element with the given tag name.
The tag name for the new element.
Node — the newly created child node, or null on error.
node.removeChild(node)
Removes a child Node from this node.
The child
Node instance to remove.boolean — true on success.
NodeCollection Object
An array-like collection ofNode objects returned by childNodes and getNodesByName().
The number of nodes in the collection. Access individual nodes by numeric index:
collection[0], collection[1], etc. Comment and text nodes (whose names begin with #) are excluded automatically.NodeAttributes Object
Returned bynode.attributes and parser.attributes, this collection provides access to an element’s XML attribute names and values.
The number of attributes on the element. Access attribute names by numeric index:
attrs[0], attrs[1], etc.attrs.getValue(name)
The attribute name to look up.
string — the attribute value, or null if not found.
attrs.setValue(name, value)
Sets or creates an attribute on the owning element.
Attribute name.
Attribute value.
boolean — true on success.
attrs.removeValue(name)
Removes an attribute from the owning element.
The attribute name to remove.
boolean — true if removed, false if the attribute was not found.
Query Object
Query is a constructable object for building parameterized SQLite queries. It is passed to an Sql instance’s query() method for execution. The constructor accepts a SQL string with {0}, {1}, … placeholders and corresponding values:
Sql object documentation for full database usage.