auto_stories Bilgi Bankası chevron_right Data API chevron_right Makale

Data API: Administration and settings

This article is for the people who install and run Xpoda. It covers switching the Data API on, its settings, caching, logging and security.

Switching it on (on-premises)

The Data API is off on a new on-premises installation. Switch it on in the Xpoda Service's appsettings.json (or the environment file your installation uses, for example appsettings.Production.json):

{
  "InboundApi": {
    "Enabled": true
  }
}

Restart the Service application pool. While it is off, every Data API address answers 404 api_disabled, and the Data API screen in Studio shows that it is not enabled.

On Xpoda Cloud the Data API is on; each customer's keys work only on that customer's database.

The Service must be reachable over HTTPS from the systems that call it. On IIS this needs an https binding on the Service site.

Settings

All settings are optional; the defaults are shown.

{
  "InboundApi": {
    "Enabled": false,
    "RequireHttps": true,
    "DefaultRateLimitPerMinute": 600,
    "MaxPageSize": 500,
    "QueryTimeoutSeconds": 30,
    "LogRetentionDays": 30,
    "Cache": {
      "Enabled": true,
      "MetadataTtlSeconds": 600,
      "StampCheckSeconds": 5,
      "KeyTtlSeconds": 60
    }
  }
}
SettingMeaning
EnabledSwitches the Data API on or off.
RequireHttpsRefuses plain HTTP requests. Turn it off only when a proxy in front of the Service ends HTTPS and forwards to the Service over an internal network.
DefaultRateLimitPerMinuteRequests per minute for keys that have no own limit. 0 means no limit.
MaxPageSizeThe largest pageSize a caller may ask for.
QueryTimeoutSecondsTime limit of each database query made for the API.
LogRetentionDaysHow long request logs are kept.
Cache:EnabledKeeps form definitions and key lookups in memory. Turn it off only to rule out caching while troubleshooting: the API works the same, more slowly.
Cache:MetadataTtlSecondsLongest time a form definition stays in memory.
Cache:StampCheckSecondsHow often the Service checks whether the module was saved in Studio. A change in Studio reaches the API within this time.
Cache:KeyTtlSecondsLongest time a key lookup stays in memory. A revoked key or changed permissions are applied at once on the Service that made the change, and within this time on other Service nodes.

Request log

Every request is logged in the customer's database (table XPODA_DATA_API_LOGS): time, key, method and path, form, record id, status, duration, caller IP address and error code. Request and response bodies are not logged. Studio shows a key's log under Usage on the Keys tab. Rows older than LogRetentionDays are removed automatically.

Rejected requests that cannot be tied to a key (for example an unknown key) are written to the Service log instead.

Tables

The Data API creates these tables in the customer's database:

TableHolds
XPODA_DATA_API_FORMSWhich forms are enabled, and their API names.
XPODA_DATA_API_KEYSKeys: name, module, API user, expiry, IP list, rate limit, revocation. Only a SHA-256 fingerprint of each key is stored.
XPODA_DATA_API_KEY_SCOPESEach key's permissions per form.
XPODA_DATA_API_LOGSThe request log.

API users are ordinary Client users (XPODA_CLIENT_USERS) with user type 10. They cannot sign in to the Client, Studio or mobile apps.

Security

  • Keys are secrets. Anyone with a key can do what the key allows. Store keys in a secret store, give each calling system its own key, and set an expiry date and an IP list where you can.
  • Least privilege. Give the API user a menu with only the forms it needs, and only the permissions it needs on each.
  • No impersonation. A key always acts as its API user; nothing in a request can change that.
  • Revoke a key as soon as it may have leaked, and create a new one.
  • Every write runs the form's Record Control rules and authorities, so the API cannot do what the API user could not do on the form screen.
  • Values are always sent to the database as parameters; field and table names come only from the form definitions.

Troubleshooting

SymptomCause
Every request returns 404 api_disabledInboundApi:Enabled is not true in the settings file the Service actually loads.
403 https_required behind a proxyThe proxy forwards over HTTP. Forward the original scheme, or set RequireHttps to false if the internal network is trusted.
403 form_not_in_menuThe form is missing from the API user's menu in Client, Users.
A field is missing from responsesThe API user's field authority hides it, or the field has no column in the form's table.
A change in Studio does not show in the APIWait Cache:StampCheckSeconds (form definitions) or Cache:KeyTtlSeconds (keys and permissions).
500 internal_errorSee the Xpoda Service log at the time of the request.