commit 404d1e1a8144ff6bae50dbcd89efdecb2f5b79de
parent 7b70553c25d6e0d23bdb6a666dc81e20e0b293d2
Author: Antoine A <>
Date: Wed, 12 Jun 2024 10:33:57 +0200
update corebank api: improve token api
Diffstat:
| M | core/api-corebank.rst | | | 105 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- |
1 file changed, 103 insertions(+), 2 deletions(-)
diff --git a/core/api-corebank.rst b/core/api-corebank.rst
@@ -49,8 +49,110 @@ client to authenticate as the admin.
.. http:post:: /accounts/$USERNAME/token
- See :ref:`DD 48 token endpoint <dd48-token>`.
+ Create or refresh an authentification token.
+ **Request:**
+
+ .. ts:def:: TokenRequest
+
+ interface TokenRequest {
+ // Scope for the token.
+ scope: "readonly" | "readwrite" | "revenue";
+
+ // Custom token validity duration
+ duration?: RelativeTime;
+
+ // Is the token refreshable into a new token during its
+ // validity?
+ // Refreshable tokens effectively provide indefinite
+ // access if they are refreshed in time.
+ refreshable?: boolean;
+
+ // Token description
+ // @since v4
+ description?: string;
+ }
+
+ **Response:**
+
+ :http:statuscode:`200 Ok`:
+ The response is a `TokenSuccessResponse`
+
+ **Details:**
+
+ .. ts:def:: TokenSuccessResponse
+
+ interface TokenSuccessResponse {
+ // Expiration determined by the server.
+ // Can be based on the token_duration
+ // from the request, but ultimately the
+ // server decides the expiration.
+ expiration: Timestamp;
+
+ // Opque access token.
+ access_token: string;
+ }
+
+.. http:delete:: /accounts/$USERNAME/token
+
+ Invalidate the access token that is being used to make the request.
+
+ **Authentication:** The client must authenticate with a valid access token.
+
+.. http:get:: /accounts/$USERNAME/tokens
+
+ Retrieve a subset of tokens related to $USERNAME.
+ @since v4
+
+ **Request:**
+
+ :query delta: *Optional.*
+ Takes value of the form ``N (-N)``, so that at most ``N`` values strictly older (younger) than ``start`` are returned. Defaults to ``-20`` to return the last 20 entries.
+ :query start: *Optional.*
+ Row number threshold, see ``delta`` for its interpretation. Defaults to smallest or biggest row id possible according to ``delta`` sign.
+
+ **Response:**
+
+ :http:statuscode:`200 OK`:
+ Response is a `TokenInfos`.
+ :http:statuscode:`204 No content`:
+ No tokens.
+
+ **Details:**
+
+ .. ts:def:: TokenInfos
+
+ interface TokenInfos {
+ tokens: TokenInfo[];
+ }
+
+ .. ts:def:: TokenInfo
+
+ interface TokenInfo {
+ // Time when the token was created.
+ creation_time: Timestamp;
+
+ // Expiration determined by the server.
+ // Can be based on the token_duration
+ // from the request, but ultimately the
+ // server decides the expiration.
+ expiration: Timestamp;
+
+ // Scope for the token.
+ scope: "readonly" | "readwrite" | "revenue";
+
+ // Is the token refreshable into a new token during its
+ // validity?
+ // Refreshable tokens effectively provide indefinite
+ // access if they are refreshed in time.
+ refreshable?: boolean;
+
+ // Token description
+ description?: string;
+
+ // Time when the token was last used.
+ last_access: Timestamp;
+ }
Bank Web UI
-----------
@@ -367,7 +469,6 @@ Account Management
Show those accounts whose histories are publicly visible. For example,
accounts from donation receivers. As such, this request is unauthenticated.
-
**Request:**
:query delta: *Optional.*