Technical guide
Technical guide

HTTP APIs and authentication

app.js mounts several API families. They have different purposes and access rules; do not treat them as one interchangeable endpoint. This page records the route contract visible in the current source, not a complete OpenAPI specification.

Generic record API: /api

Method Path Purpose
GET /api/describe/:objectName Return object name, label, and fields.
GET /api/list/:objName List records using the object's search layout.
GET /api/data/:objectName Alias for the list behavior.
GET /api/data/:objectName/:recordId Read one accessible record.
POST /api/data/:objectName Create one or more records.
PATCH /api/data/:objectName/:recordId Update the identified record.
DELETE /api/data/:objectName/:recordId Delete a non-metadata record.

POST and PATCH accept a JSON record object or an array of record objects. Field names are checked against the current object schema; unknown names fail. PATCH requires the URL record ID, and a body Id, if supplied, must match it. DELETE rejects metadata objects. The list endpoint can accept a Base64-encoded JSON filter query parameter containing conditions and logic; see controllers/apiController.js before using advanced filter syntax in a client.

GET /api/describe/:objectName?writable=true returns only fields writable by the current user and requires create access for a non-metadata object. The CSV loader uses this before mapping columns. Its row writes use the ordinary POST endpoint and can succeed or fail independently. The list response also includes name-field metadata so the table can link every marked name field.

Browser sessions can authenticate /api requests. Bearer tokens can also authenticate requests, with api.read needed for GET/HEAD and api.write for mutations. The permission engine still applies the user's access. Missing or invalid authentication returns 401; an insufficient bearer scope returns 403.

OAuth

/oauth/authorize is the authorization-code consent route and /oauth/token exchanges a supported grant for tokens. The code supports authorization_code, client_credentials, and refresh_token at the token endpoint. OAuth clients configure allowed flows, scopes, redirect URLs, and an optional Run as user for client credentials. Supported scopes are api.read, api.write, and offline_access; refresh tokens belong to the authorization-code flow. PKCE uses S256 when supplied and can be required by the client. Redirect URLs must match their registration exactly.

Administrators manage clients under Admin Setup → OAuth Clients. Keep client secrets and tokens out of docs, URLs, screenshots, and logs. Review routes/oauth.js, services/oauthService.js, and lib/oauthScopes.js for the authoritative current behavior.

Other route families

  • /api/meta: administrative metadata operations such as email configuration and object field changes; it is not the generic record API.
  • /server/:ns/:moduleName/:moduleMethod: module RPC entry point.
  • /server/qualified/:ns/:moduleName/:moduleMethod: explicitly qualified module RPC entry point, used by serverCall for names such as c__inventory.
  • /we-rest/:ns/...: configured authenticated REST routes that resolve to module methods.
  • /we-public/:ns/...: configured public REST routes; the mapping still determines whether a route exists and is active.
  • /component/...: generated browser component assets and descriptions.

The current implementation is the source of truth for payload details and authorization. Add an OpenAPI file only after individual endpoints and error schemas have been validated with representative callers.