commit f962571c30e8ea650bc1d13f95f12bfc664f07c2 parent f8bff544a82a0f80eb76d9ddc4855232176258cb Author: Martin Schanzenbach <schanzen@gnunet.org> Date: Mon, 23 Jun 2025 07:30:42 +0200 new API for 10118 Diffstat:
| M | core/api-merchant.rst | | | 81 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- |
1 file changed, 80 insertions(+), 1 deletion(-)
diff --git a/core/api-merchant.rst b/core/api-merchant.rst @@ -1258,13 +1258,92 @@ Setting up instances refreshable: boolean; } -.. http:delete:: [/instances/$INSTANCE]/private/token +.. http:get:: [/instances/$INSTANCE]/private/tokens + + Retrieve a subset of tokens. + @since **vTOKENS** + + **Required permissions**: ``tokens-read`` + + **Request:** + + :query limit: *Optional.* + At most return the given number of results. Negative for descending by ``row_id``, positive for ascending by ``row_id``. Defaults to ``-20``. + :query offset: *Optional.* + Starting ``serial`` for :ref:`pagination <row-id-pagination>`. + + **Response:** + + :http:statuscode:`200 OK`: + Response is a `TokenInfos`. + :http:statuscode:`204 No content`: + No tokens. + :http:statuscode:`401 Unauthorized`: + Invalid or missing credentials. + :http:statuscode:`403 Forbidden`: + Missing rights. + + **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" | "wiregateway"; + + // 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; + + // Optional token description + description?: string; + + // Time when the token was last used. + last_access: Timestamp; + + // Opaque unique ID used for pagination. + serial: Integer; + } + +.. http:delete:: [/instances/$INSTANCE]/private/tokens/$ID + + Delete a token by its serial. + @since **vTOKENS** + + **Required permission**: ``tokens-write`` **Response:** :http:statuscode:`204 No content`: The access token used to authorize this request was revoked. + :http:statuscode:`401 Unauthorized`: + Invalid or missing credentials. + :http:statuscode:`403 Forbidden`: + Missing permission. + +.. http:delete:: [/instances/$INSTANCE]/private/token + **Response:** + + :http:statuscode:`204 No content`: + The access token used to authorize this request was revoked. .. http:patch:: /management/instances/$INSTANCE .. http:patch:: [/instances/$INSTANCE]/private