GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — rain/docs/api.md at develop · mxsm/rain

Expand file tree

/

api.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
135 lines (94 loc) · 4.38 KB
/

api.md

Copy path

File metadata and controls

135 lines (94 loc) · 4.38 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Rain API

Base path: /api/v1

All API responses use the same envelope:

{
  "data": 123,
  "status": "SUCCESS",
  "code": "SUCCESS",
  "msg": "SUCCESS"
}

Errors use the same envelope with a stable code and an HTTP status. Common codes:

  • VALIDATION_ERROR
  • UNAUTHORIZED
  • BIZ_CODE_NOT_FOUND
  • SEGMENT_ALLOCATE_FAILED
  • UID_UNAVAILABLE
  • CLOCK_MOVED_BACKWARDS
  • WORKER_ID_UNAVAILABLE
  • UPSTREAM_UNAVAILABLE
  • INTERNAL_ERROR

GET /api/v1/segment/identity?bizCode=orders returns the registered allocation row ID as a decimal string in the v1 success envelope. The database uses its existing equality rules. The lookup does not advance the cursor. An unknown code returns 404. Identity is scoped to a single database writer.

Authentication

When mxsm.uid.security.enabled=true, send one of:

Authorization: Bearer <token>
X-API-Key: <token>

Generation and read endpoints accept mxsm.uid.security.tokens or mxsm.uid.security.admin-tokens. The admin endpoint POST /api/v1/segment/rg accepts only admin-tokens. Requests with a missing token or a generation-only token return HTTP 401 with code UNAUTHORIZED and leave the business code unregistered.

/actuator/health/** and /actuator/info do not require a token.

Segment APIs

Register Biz Code

POST /api/v1/segment/rg
Content-Type: application/json
Authorization: Bearer <admin-token>
{
  "bizCode": "orders",
  "step": 1000
}

bizCode is limited to 128 characters. Registration and allocation share the same business key, so Orders, orders, and orders use one cursor. step must be positive.

Pass the original business name to the SDK, including literal percent characters. Path clients must UTF-8 percent-encode each name as one path segment. For example, a literal space is %20 and a literal "%20" is %2520. Registration accepts slashes, backslashes and dot-only names as well. For these names use POST /api/v1/segment/uid?bizCode=... or GET /api/v1/segment/list?bizCode=...&segmentNum=... with a query-encoded value, including for names registered before these routes were introduced. The same query routes under /api/v2 return exact decimal strings. Upgrade servers before clients that need the query routes.

Generate Segment UID

POST /api/v1/segment/uid/{bizCode}
Authorization: Bearer <token>

Legacy compatibility:

GET /api/v1/segment/uid/{bizCode}

The GET endpoint is deprecated because ID generation has side effects. All /api/v1/** responses include Cache-Control: no-store.

Allocate Segment List

GET /api/v1/segment/list/{bizCode}?segmentNum=16
Authorization: Bearer <token>

This endpoint is used by the Java SDK local segment cache. segmentNum must be between 1 and 10000.

Snowflake APIs

Generate Snowflake UID

POST /api/v1/snowflake/uid
Authorization: Bearer <token>

Legacy compatibility:

GET /api/v1/snowflake/uid

The GET endpoint is deprecated.

Server and local SDK generation require the clock to fall within the configured timestamp field. Both endpoints of the range are valid. An out-of-range clock rejects local generator startup or returns UID_UNAVAILABLE (HTTP 503 on the server) if the field expires while running.

Parse Snowflake UID

GET /api/v1/snowflake/parse/{uid}
Authorization: Bearer <token>

Returns timestamp, machine ID, and sequence.

Decimal-string IDs for JavaScript

Consumers can opt into the following v2 routes. They use the same authentication, error envelope and cache policy as v1. The v1 routes keep their numeric fields. Create business codes through the existing v1 registration route.

Route Exact decimal string
POST /api/v2/snowflake/uid data
POST /api/v2/segment/uid/{bizCode} data
GET /api/v2/snowflake/parse/{uid} data.uid
GET /api/v2/segment/list/{bizCode}?segmentNum=2 data[].segmentStartNum

Keep the original string as an object or map key. Use BigInt for arithmetic.

const { data: id } = await response.json();
const byId = new Map([[id, order]]);
const exact = BigInt(id);

Missing required query parameters, invalid path or query parameter types, and unreadable JSON bodies return HTTP 400. For example, GET /api/v1/segment/list/orders without segmentNum returns a response containing {"status":"EXCEPTION","code":"VALIDATION_ERROR","data":null,"msg":"Missing parameter segmentNum"}.

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.