Docly Developers
Section13 pages

Network functions

Functions for calling external APIs and sites.

getRemoteIp()Returns the visitor's IP address for the current request. When a WAF/proxy client-IP header is configured for the site's domain, the…downloadFromUrl(url)Downloads text from the specified URL. Pass several URLs to download them in order and get the texts joined into one string. Only http://…downloadFromUrl64(mimeType, url)Downloads a file from the specified URL and returns it as a base64 data URL (data:<mimeType>;base64,...), ready to use in an img src or a…httpGet(url, headers?)Calls specified web service and expects JSON. Parses JSON to object.httpPut(url, data, headers?)Calls specified web service with method PUT. Expects JSON. Parses JSON to object.httpPost(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.httpDelete(url, headers?)Calls the specified web service with method DELETE. Expects JSON and parses it to an object.httpFormPost(url, data, headers?)Same as httpPost, but values are posted as form fields instead of a JSON body.httpFetch(url, options?)Calls a URL and returns the full HTTP response — status code, response headers and the raw, unparsed body — unlike httpGet, which returns…getUploadBase64(targetFileName)Returns an uploaded file, picked by its form field name, as a base64 encoded string.getUploads()Returns the files uploaded with the current request (a multipart/form-data post). Use it to accept file uploads in your own API functions.getAIModels()Lists the AI models the site can use with promptAI. Requires AI to be enabled on the workspace's subscription (otherwise error 1, "AI…promptAI(model, messages)Sends a conversation to one of Docly's AI models and returns the reply. Requires AI to be enabled on the workspace's subscription…