HTTP & Secrets
Call external HTTP APIs from scripts, restricted by the HTTP whitelist, with credentials kept in encrypted secrets.
VARIO Cloud scripts can call external HTTP APIs directly from the backend. This turns every workflow and batch script into an integration point: push data to a newsletter tool, post a message to a chat channel, ask an AI model for a product text, fetch leads from a form service or download images into the DMS, all without middleware.
Two safeguards keep this under control:
HTTP whitelist: a script can only reach targets that an administrator has explicitly allowed.
Secrets: passwords, API keys and tokens are stored encrypted and referenced by a placeholder, so they never appear in the script source.
Both are managed in VARIO Cloud under System → Skripte, in the sections HTTP-Whitelist and Secrets.
HTTP Client
Scripts access HTTP through ctx.services.httpClientService. It creates a client, the client creates a request, and the request is sent with execute().
createHttpClient()
Client without authentication
createHttpClientWithBearerAuth(token)
Client that sends Authorization: Bearer <token>
createHttpClientWithBasicAuth(username, password)
Client that sends HTTP Basic authentication; the encoded header is logged, see Secrets
Requests
A client offers createGetRequest(), createPostRequest() and createPutRequest(). DELETE and PATCH are not available.
uri(uri)
Target URL (required)
uriParameter(name, value)
Adds a query parameter
header(name, ...values)
Adds a header
contentType(type)
Sets the Content-Type header; not allowed on GET
body(string)
Request body; not allowed on GET
timeoutInSeconds(seconds)
Request timeout, at most 300 seconds
execute()
Sends the request and returns the response
Responses
getHttpStatus()
HTTP status code
getBody()
Body as string (charset from the content type, default UTF-8)
getBodyAsBytes()
Body as bytes
getContentType()
Content type
hasHeader(name), getHeaderValue(name), getHeaderValueAsList(name), getHeaders()
Response headers
Error Handling
A 4xx or 5xx response throws an exception with the message "HTTP-Request ist fehlgeschlagen: …", which names the status, method and URL. A 3xx response is returned normally; redirects are not followed. Catch the exception when a failing call must not abort the whole workflow or batch row:
Limits
Request body
10 MiB (counted in characters, before placeholders are resolved)
Response body
10 MiB; larger responses are cut off without an error
Timeout per request
300 seconds
Methods
GET, POST, PUT
The same client is used by shelfDocumentService.downloadIntoDMS(), so downloads are subject to the same whitelist and limits. A file larger than 10 MiB is stored incomplete.
HTTP Whitelist
Every outgoing request is checked against the whitelist. If no active entry matches, the request is rejected with the message "Request zu Domain … ist nicht erlaubt". An empty whitelist blocks all requests.
Each entry has a type and a value. Matching is case-insensitive and only active entries count.
DOMAIN
Exact host name, any scheme and port
api.example.com
https://api.example.com/any/path?x=1, also http://
https://eu.api.example.com/…
URL
Exact URL, including the query string
https://api.example.com/v1/data
exactly this URL
https://api.example.com/v1/data?page=2
URL_PATTERN
Whole URL against a pattern, * matches any characters
https://api.example.com/v2/*
https://api.example.com/v2/items
https://api.example.com/v1/items
A DOMAIN entry covers exactly one host. Subdomains need their own entry or a URL_PATTERN. A value with a leading dot (.example.com) is accepted when saving but never matches a request.
Prefer the narrowest entry that works: a DOMAIN for one API host, a URL_PATTERN for a fixed path prefix. Keep the host part of a pattern literal.
* matches any characters, including / and .. A * in the host part therefore opens the whitelist to any host: https://*.example.com/* also matches https://attacker.test/x.example.com/. Use a separate DOMAIN entry per subdomain instead.
Secrets
A secret is a named, encrypted set of key/value pairs, for example a secret newsletter with the keys apiKey and listId. Secrets are stored per tenant and encrypted at rest; the user interface never shows a stored value again.
Scripts have no service to read a secret. Instead, you write a placeholder into the request, and the HTTP client replaces it with the decrypted value just before the request leaves VARIO Cloud:
A single string may contain several placeholders.
Where Placeholders Are Resolved
Header values (header())
Yes
Request body (body())
Yes
Bearer token (createHttpClientWithBearerAuth())
Yes, because it is sent as a header
authValue of shelfDocumentService.downloadIntoDMS()
Yes
URL (uri()) and query parameters (uriParameter())
No
Username and password of createHttpClientWithBasicAuth()
No, the credentials are encoded before resolution
This means createHttpClientWithBasicAuth() cannot take placeholders, and you cannot put a secret into the URL. Literal credentials passed to createHttpClientWithBasicAuth() end up Base64-encoded in the log, which is as good as plain text. For Basic authentication, store the already Base64-encoded username:password as a secret value and send the header yourself: header('Authorization', 'Basic {{secret:erp2shop:basic}}'). If an API expects the key as a query parameter, check whether it accepts it as a header instead.
Using a Secret
Placeholders keep secrets out of the script source, but they do not make them unreadable for scripts. A script can send a placeholder to any whitelisted target, including one that echoes the request back. Keep the whitelist narrow; it is what protects your secrets.
Errors
Secret name does not exist
"Secret mit dem Namen … wurde nicht gefunden"
Key does not exist in the secret
"Key '…' im Secret '…' wurde nicht gefunden"
Inside the HTTP client these errors are wrapped as "HTTP-Request ist fehlgeschlagen: …"; downloadIntoDMS() reports them unwrapped. The name of a missing secret is currently not filled into the message.
Placeholder values are inserted as they are, without URL or JSON escaping. If a secret contains characters like " or &, make sure the surrounding body format can carry them.
Downloading Files into the DMS
shelfDocumentService.downloadIntoDMS() fetches a file over HTTP and stores it as a DMS document. It returns the created document, which you can then attach to a record.
downloadIntoDMS(url, documentTypeKey)
Download without authentication
downloadIntoDMS(url, authType, authValue, documentTypeKey)
authType is BEARER_TOKEN or BASIC_AUTH; for BASIC_AUTH, authValue is username:password
With BEARER_TOKEN or BASIC_AUTH, the placeholder in authValue is resolved before the request is logged. The log entry therefore contains the real token or the Base64-encoded username:password. Restrict who can read the logs, or use a download URL that needs no authentication.
Checklist for a New Integration
Add the API host to System → Skripte → HTTP-Whitelist.
Create a secret under System → Skripte → Secrets with the keys the API needs.
Reference the keys as
{{secret:<name>:<key>}}in headers or body.Wrap the call in
try/catchand log failures.Trigger the script from a workflow, a batch run or a scheduled script processing, see Use Cases.
Last updated
Was this helpful?