• Start

Methods

api

The api() method for the SurrealDB Mojo SDK calls a custom API handler defined on the database.

Calls a custom API handler defined on the database with DEFINE API.

Method Syntax
client.api(path, method, session, txn)

Argument

Description

path

The API path to call.

method

The HTTP method. Defaults to

"GET"

.

session

An optional session id.

txn

An optional transaction id.

var resp = client.api("/users", "GET")
Note

The API endpoint is checked against the active transport's capabilities. If the transport does not support it, the SDK raises an UnsupportedFeatureError.

Was this page helpful?