Network functions

Functions for calling external APIs and sites.

http­Put
get­Remo­te­Ip

Use this to get the user's IP address from the current request.

down­load­Fro­mUr­l(url)

Downloads text from specified URL.

down­load­Fro­mUrl6­4(url)

Downloads text from specified URL and BASE64 encodes it.

http­Get(url, headers)

Calls specified web service and expects JSON. Parses JSON to object.

http­Pos­t(url, data, options)

Calls specified web service with HTTP POST, sending a JSON body. Expects JSON in the response and parses it to an object.

http­Form­P­os­t(url, data, headers)

Same as httpPost, but values are posted as form fields instead of a JSON body.

http­Fetc­h(url, options)

Calls a URL and returns the full HTTP response — status code, response headers and the raw, unparsed body — unlike httpGet, which returns only the JSON-parsed body. Use it to inspect any web page or API: security headers, HTTP→HTTPS redirects, raw HTML, compression and timing. gzip/deflate/br bodies are decompressed automatically while the original content-encoding header is kept. On failure it returns { DoclyError: "..." } instead of throwing.

ge­tUp­load­B­ase6­4(filename)

Returns a file by name from the uploaded form as a base64 encoded string.

ge­tUp­load­s

Returns an array of uploaded files. Use this function to support uploading files through your custom Docly pure JS APIs.