Function API only Updated 23 Oct 2026
httpGet(url, [headers])
Calls specified web service and expects JSON. Parses JSON to object.
Parameters
urlstringrequiredURL to call with HTTP GET.
headersobjectoptionalName / value object that will be converted to HTTP headers.
Returns
Returns the JSON answer parsed to an object.
Errors do not throw: if the call fails, or the answer is not JSON, the result is { DoclyError: "<message>" }. The HTTP status code is not returned — use httpFetch when you need it.
Security: requests to Docly's own platform domains (and their subdomains) and to cloud metadata / link-local addresses are always blocked — also after a redirect — and the call returns { DoclyError }. The Host header cannot be set. Private networks are only blocked by httpFetch with blockPrivateNetworks: true.
Example
Normal JavaScript, running in the browser or on the Docly™ server.
export default () => {
let config = docly.getJson("#/Config") || {}; // keep credentials in #/Config, never in code
let headers = {
"Authorization": "Basic " + docly.base64(config.ApiUser + ":" + config.ApiPassword)
};
// Call some API
let result = docly.httpGet("https://api.example.com/v1/items?id=1", headers);
// Handle error
if (result && result.DoclyError) throw new Error("The external API did not answer");
return result;
}