Eternaltwin API
Eternaltwin exposes all its data through a REST API, mounted under /api/v1.
Some resources are protected and require the right authorization.
The endpoint reference lives under /api.
Official clients
There are official clients for various platforms. You should use them instead of writing your own client:
| Platform | Package | In the repository |
|---|---|---|
| Kotlin / Java | net.eternaltwin:etwin | clients/kotlin |
| Node / TypeScript | @eternaltwin/client-node | sdk/node/client |
| PHP | eternaltwin/etwin | sdk/php/client |
| Ruby | etwin | clients/ruby |
See also the examples, one per platform.
Beside the clients, sdk/node and sdk/php also ship the packages that start an Eternaltwin
binary from a test suite — @eternaltwin/sdk, eternaltwin/exe, eternaltwin/test-server. They
run a server; they are not a way to call one.
What the clients actually cover
These clients are not complete, and they do not all cover the same ground. Help is welcome to improve them.
| Client | Covers |
|---|---|
| Kotlin | getSelf, getUser, getDinoparcUser, getDinoparcDinoz |
| Node | getAuthSelf, getUserById, createSession |
| PHP | getSelf, getUser |
| Ruby | get_user only — there is no get_self, so a Ruby application resolves the token itself |
So the common floor is smaller than it looks: every client can retrieve data about a user, and all but the Ruby one can resolve the current authentication (enough to authenticate users with an OAuth access token). Anything else is called over plain HTTP.
The Node client also exposes rawRequest, but it is not a general escape hatch: it sends a GET
or a POST to an absolute URI with headers the caller builds itself, and its answer carries only
the status and the response headers — never the body. It exists for the redirect-following steps of
the authorization flow, not for reading JSON.
None of them covers the forum
The clients stop there: none of them has a single forum type or forum call, whatever the platform.
Taking part in the forum on behalf of a user means calling /api/v1/forum over plain HTTP with the
bearer token, and is described in The forum from an application.