0

http

To send an HTTP request

What it does

http() lets your script call any REST API—to pull data from another service or push data between Ninox databases.

ℹ️ Accessing a different Ninox database requires an API key.

Where to run it

⚠️ Don't place http() inside do as transaction...end

Transactions share the same single-threaded write queue, so an HTTP call inside a transaction blocks all other writes until the request finishes. This doesn't hang forever, but it stalls every pending write for the full duration of the call and can make the app feel sluggish.

Context Timeout Why it matters
Inside do as server...end ≈ 20–120 s

Recommended—prevents the client UI from freezing and imposes a safety timeout, and follows Ninox's best-practice guidance.
Optimize performance of scripts ↗

Outside do as server...end None (waits indefinitely) Blocks the UI until the API responds; use with care.

Parameters

Name Type Required Purpose
method String ☑️ HTTP verb (e.g. "GET", "POST")
url String ☑️ Endpoint URL
header JSON HTTP headers (API key, content-type, …)
body JSON Request payload
files [file] Files to upload (server context only)

Syntax

http(method, url)
http(method, url, header)
http(method, url, header, body)
http(method, url, header, files)
http(method, url, header, body, files)

Return value

Always returns a JSON object—either the API's response or an error description.

Examples

1. List all tables in the current database

let url := "https://api.ninoxdb.de/v1/teams/" + teamId() +
           "/databases/" + databaseId() + "/tables/";
let apiKey := "Bearer abcd1234-0000-xxxx-zzzz-1a1aa1aaa1a111";

let response := http("GET", url, {
  Authorization: apiKey
});
response  // JSON array of tables or an error object

2. Query records on the server

do as server
  let url := "https://api.ninoxdb.de/v1/teams/" + teamId() +
             "/databases/" + databaseId() + "/query";
  let apiKey := "Bearer abcd1234-0000-xxxx-zzzz-1a1aa1aaa1a111";

  let response := http("POST", url, {
    Authorization: apiKey,
    "content-type": "application/json"
  }, {
    query: "select Kunden where Status = 4"
  });
  response  // Matching records or an error object
end

3. Upload a file

do as server
  let response := http("POST",
                       "https://example.com/upload",
                       { "content-type": "multipart/form-data" },
                       null,
                       [myFile])
end

See also

Introduction to the Ninox API

API calls in Ninox script

Reply

null