Skip to content
This page View Markdown Open in ChatGPT Open in Claude

Get redis key

Reads values you stored with set redis key from the external Redis of API Maker (the one which also holds the cache of the APIs). Keys are kept in a namespace of the account, so two accounts never see each other's keys.

Method POST
URL /api/system-api/admin/get-redis-key : admin is the user path of your account
Body { keys }
Answer data : the value (a string, null when the key is not there), or an array of values
From code g.sys.cache.getKey

The call

Body : one key
{ "keys": "session:user123" }
Answer
{ "success": true, "statusCode": 200, "data": "{\"cart\":3}" }
Body : several keys
{ "keys": [ "session:user123", "captcha:abc" ] }
Answer
{ "success": true, "statusCode": 200, "data": [ "{\"cart\":3}", null ] }
  • Values are strings : JSON.parse what you stored as JSON.

From code

const raw = await g.sys.cache.getKey('session:user123');
const session = raw ? JSON.parse(raw) : null;

Access and settings

  • Over HTTP, a system API answers once its settings give it apiAccessType: TOKEN_ACCESS (the token of an API user whose group grants this system API, in x-am-authorization) or IS_PUBLIC. Without settings it is NO_ACCESS : your code calls it through g.sys, the admin panel tests it, and an HTTP call is refused.
  • The settings can also cache the answer or require person tokens (authProviders) ; pre and post hooks run around it like around any API.
  • The request headers apply : x-am-response-case, x-am-content-type-response, x-am-internationalization, x-am-tenant-username…

Errors

Code When
400 The body is wrong : the message names the missing or invalid key.
401 No valid API user token, or the API is NO_ACCESS : You are not authorized to access this API.
403 No group grants this system API.