Skip to content

Commit c645d2a

Browse files
committed
Merge branch 'main' into upgrade/swagger-codegen-cli
Signed-off-by: ff137 <[email protected]>
2 parents 7b82ce8 + a848bcb commit c645d2a

29 files changed

+1508
-185
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Temporary Items
154154
###
155155

156156
.idea/*
157+
**/.idea/*
157158

158159
###
159160
### Windows
@@ -188,4 +189,8 @@ _build/
188189
**/*.iml
189190

190191
# Open API build
191-
open-api/.build
192+
open-api/.build
193+
194+
# poetry
195+
poetry.lock
196+
pyproject.toml

AdminAPI.md

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,72 @@
22

33
## Using the OpenAPI (Swagger) Interface
44

5-
ACA-Py provides an OpenAPI-documented REST interface for administering the agent's internal state and sparking communication with connected agents.
5+
ACA-Py provides an OpenAPI-documented REST interface for administering the agent's internal state and initiating communication with connected agents.
66

7-
To see the specifics of the supported endpoints as well as the expected request and response formats it is recommended to run the `aca-py` agent with the `--admin {HOST} {PORT}` and `--admin-insecure-mode` command line parameters, which exposes the OpenAPI UI on the provided port for interaction via a web browser. Production deployments should run the agent with `--admin-api-key {KEY}` and add the `X-API-Key: {KEY}` header to all requests instead of running the agent with the `--admin-insecure-mode` parameter.
7+
To see the specifics of the supported endpoints, as well as the expected request and response formats, it is recommended to run the `aca-py` agent with the `--admin {HOST} {PORT}` and `--admin-insecure-mode` command line parameters. This exposes the OpenAPI UI on the provided port for interaction via a web browser. For production deployments, run the agent with `--admin-api-key {KEY}` and add the `X-API-Key: {KEY}` header to all requests instead of using the `--admin-insecure-mode` parameter.
88

99
![Admin API Screenshot](/docs/assets/adminApi.png)
1010

1111
To invoke a specific method:
1212

13-
* scroll to and find that endpoint;
14-
* click on the endpoint name to expand its section of the UI;
15-
* click on the Try it out button;
16-
* fill in any data necessary to run the command;
17-
* click Execute;
18-
* check the response to see if the request worked as expected.
13+
* Scroll to and find that endpoint;
14+
* Click on the endpoint name to expand its section of the UI;
15+
* Click on the Try it out button;
16+
* Fill in any data necessary to run the command;
17+
* Click Execute;
18+
* Check the response to see if the request worked as expected.
1919

20-
The mechanical steps are easy, it’s fourth step from the list above that can be tricky. Supplying the right data and, where JSON is involved, getting the syntax correct - braces and quotes can be a pain. When steps dont work, start your debugging by looking at your JSON. You may also choose to use a REST client like Postman or Insomnia which will provide syntax highlighting and other features to simplify the process.
20+
The mechanical steps are easy; however, the fourth step from the list above can be tricky. Supplying the right data and, where JSON is involved, getting the syntax correctbraces and quotes can be a pain. When steps don't work, start your debugging by looking at your JSON. You may also choose to use a REST client like Postman or Insomnia, which will provide syntax highlighting and other features to simplify the process.
2121

22-
Because API methods will often kick off asynchronous processes, the JSON response provided by an endpoint is not always sufficient to determine the next action. To handle this situation as well as events triggered due to external inputs (such as new connection requests), it is necessary to implement a webhook processor, as detailed in the next section.
22+
Because API methods often initiate asynchronous processes, the JSON response provided by an endpoint is not always sufficient to determine the next action. To handle this situation, as well as events triggered by external inputs (such as new connection requests), it is necessary to implement a webhook processor, as detailed in the next section.
2323

24-
The combination of an OpenAPI client and webhook processor is referred to as an ACA-Py Controller and is the recommended method to define custom behaviours for your ACA-Py-based agent application.
24+
The combination of an OpenAPI client and webhook processor is referred to as an ACA-Py Controller and is the recommended method to define custom behaviors for your ACA-Py-based agent application.
2525

2626
## Administration API Webhooks
2727

2828
When ACA-Py is started with the `--webhook-url {URL}` command line parameter, state-management records are sent to the provided URL via POST requests whenever a record is created or its `state` property is updated.
2929

30-
When a webhook is dispatched, the record `topic` is appended as a path component to the URL, for example: `https://webhook.host.example` becomes `https://webhook.host.example/topic/connections` when a connection record is updated. A POST request is made to the resulting URL with the body of the request comprised by a serialized JSON object. The full set of properties of the current set of webhook payloads are listed below. Note that empty (null-value) properties are omitted.
30+
When a webhook is dispatched, the record `topic` is appended as a path component to the URL. For example, `https://webhook.host.example` becomes `https://webhook.host.example/topic/connections` when a connection record is updated. A POST request is made to the resulting URL with the body of the request comprising a serialized JSON object. The full set of properties of the current set of webhook payloads are listed below. Note that empty (null-value) properties are omitted.
3131

32-
#### Pairwise Connection Record Updated (`/connections`)
32+
### Pairwise Connection Record Updated (`/connections`)
3333

34-
* `connection_id`: the unique connection identifier
35-
* `state`: `init` / `invitation` / `request` / `response` / `active` / `error` / `inactive`
36-
* `my_did`: the DID this agent is using in the connection
37-
* `their_did`: the DID the other agent in the connection is using
38-
* `their_label`: a connection label provided by the other agent
39-
* `their_role`: a role assigned to the other agent in the connection
40-
* `inbound_connection_id`: a connection identifier for the related inbound routing connection
41-
* `initiator`: `self` / `external` / `multiuse`
42-
* `invitation_key`: a verification key used to identify the source connection invitation
43-
* `request_id`: the `@id` property from the connection request message
44-
* `routing_state`: `none` / `request` / `active` / `error`
45-
* `accept`: `manual` / `auto`
46-
* `error_msg`: the most recent error message
47-
* `invitation_mode`: `once` / `multi`
48-
* `alias`: a local alias for the connection record
34+
* `connection_id`: the unique connection identifier
35+
* `state`: `init` / `invitation` / `request` / `response` / `active` / `error` / `inactive`
36+
* `my_did`: the DID this agent is using in the connection
37+
* `their_did`: the DID the other agent in the connection is using
38+
* `their_label`: a connection label provided by the other agent
39+
* `their_role`: a role assigned to the other agent in the connection
40+
* `inbound_connection_id`: a connection identifier for the related inbound routing connection
41+
* `initiator`: `self` / `external` / `multiuse`
42+
* `invitation_key`: a verification key used to identify the source connection invitation
43+
* `request_id`: the `@id` property from the connection request message
44+
* `routing_state`: `none` / `request` / `active` / `error`
45+
* `accept`: `manual` / `auto`
46+
* `error_msg`: the most recent error message
47+
* `invitation_mode`: `once` / `multi`
48+
* `alias`: a local alias for the connection record
4949

50-
#### Basic Message Received (`/basicmessages`)
50+
### Basic Message Received (`/basicmessages`)
5151

52-
* `connection_id`: the identifier of the related pairwise connection
53-
* `message_id`: the `@id` of the incoming agent message
54-
* `content`: the contents of the agent message
55-
* `state`: `received`
52+
* `connection_id`: the identifier of the related pairwise connection
53+
* `message_id`: the `@id` of the incoming agent message
54+
* `content`: the contents of the agent message
55+
* `state`: `received`
5656

57-
#### Forward Message Received (`/forward`)
57+
### Forward Message Received (`/forward`)
5858

5959
Enable using `--monitor-forward`.
6060

61-
* `connection_id`: the identifier of the connection associated with the recipient key
62-
* `recipient_key`: the recipient key of the forward message (`to` field of the forward message)
63-
* `status`: The delivery status of the received forward message. Possible values:
64-
* `sent_to_session`: Message is sent directly to the connection over an active transport session
65-
* `sent_to_external_queue`: Message is sent to external queue. No information is known on the delivery of the message
66-
* `queued_for_delivery`: Message is queued for delivery using outbound transport (recipient connection has an endpoint)
67-
* `waiting_for_pickup`: The connection has no reachable endpoint. Need to wait for the recipient to connect with return routing for delivery
68-
* `undeliverable`: The connection has no reachable endpoint, and the internal queue for messages is not enabled (`--enable-undelivered-queue`).
61+
* `connection_id`: the identifier of the connection associated with the recipient key
62+
* `recipient_key`: the recipient key of the forward message (`to` field of the forward message)
63+
* `status`: The delivery status of the received forward message. Possible values:
64+
* `sent_to_session`: Message is sent directly to the connection over an active transport session
65+
* `sent_to_external_queue`: Message is sent to an external queue. No information is known on the delivery of the message
66+
* `queued_for_delivery`: Message is queued for delivery using outbound transport (recipient connection has an endpoint)
67+
* `waiting_for_pickup`: The connection has no reachable endpoint. Need to wait for the recipient to connect with return routing for delivery
68+
* `undeliverable`: The connection has no reachable endpoint, and the internal queue for messages is not enabled (`--enable-undelivered-queue`).
6969

70-
#### Credential Exchange Record Updated (`/issue_credential`)
70+
### Credential Exchange Record Updated (`/issue_credential`)
7171

7272
* `credential_exchange_id`: the unique identifier of the credential exchange
7373
* `connection_id`: the identifier of the related pairwise connection
@@ -88,37 +88,37 @@ Enable using `--monitor-forward`.
8888
* `auto_issue`: (boolean) whether to automatically issue the credential
8989
* `error_msg`: the previous error message
9090

91-
#### Presentation Exchange Record Updated (`/present_proof`)
91+
### Presentation Exchange Record Updated (`/present_proof`)
9292

93-
* `presentation_exchange_id`: the unique identifier of the presentation exchange
94-
* `connection_id`: the identifier of the related pairwise connection
95-
* `thread_id`: the thread ID of the previously received presentation proposal or offer
96-
* `initiator`: present-proof exchange initiator: `self` / `external`
97-
* `state`: `proposal_sent` / `proposal_received` / `request_sent` / `request_received` / `presentation_sent` / `presentation_received` / `verified`
98-
* `presentation_proposal_dict`: the presentation proposal message
99-
* `presentation_request`: (Indy) presentation request (also known as proof request)
100-
* `presentation`: (Indy) presentation (also known as proof)
101-
* `verified`: (string) whether the presentation is verified: `true` or `false`
102-
* `auto_present`: (boolean) prover choice to auto-present proof as verifier requests
103-
* `error_msg`: the previous error message
93+
* `presentation_exchange_id`: the unique identifier of the presentation exchange
94+
* `connection_id`: the identifier of the related pairwise connection
95+
* `thread_id`: the thread ID of the previously received presentation proposal or offer
96+
* `initiator`: present-proof exchange initiator: `self` / `external`
97+
* `state`: `proposal_sent` / `proposal_received` / `request_sent` / `request_received` / `presentation_sent` / `presentation_received` / `verified`
98+
* `presentation_proposal_dict`: the presentation proposal message
99+
* `presentation_request`: (Indy) presentation request (also known as proof request)
100+
* `presentation`: (Indy) presentation (also known as proof)
101+
* `verified`: (string) whether the presentation is verified: `true` or `false`
102+
* `auto_present`: (boolean) prover choice to auto-present proof as verifier requests
103+
* `error_msg`: the previous error message
104104

105-
## API Standard Behaviour
105+
## API Standard Behavior
106106

107107
The best way to develop a new admin API or protocol is to follow one of the existing protocols, such as the Credential Exchange or Presentation Exchange.
108108

109109
The `routes.py` file contains the API definitions - API endpoints and payload schemas (note that these are not the Aries message schemas).
110110

111-
The payload schemas are defined using [marshmallow](https://marshmallow.readthedocs.io/) and will be validated automatically when the API is executed (using a middleware). (This raises a status `422` HTTP response with an error message if the schema validation fails.)
111+
The payload schemas are defined using [marshmallow](https://marshmallow.readthedocs.io/) and will be validated automatically when the API is executed (using middleware). (This raises a status `422` HTTP response with an error message if the schema validation fails.)
112112

113-
API endpoints are defined using [aiohttp_apispec](https://github.com/maximdanilchenko/aiohttp-apispec) tags (e.g. `@doc`, `@request_schema`, `@response_schema` etc.) which define the input and output parameters of the endpoint. API url paths are defined in the `register()` method and added to the swagger page in the `post_process_routes()` method.
113+
API endpoints are defined using [aiohttp_apispec](https://github.com/maximdanilchenko/aiohttp-apispec) tags (e.g. `@doc`, `@request_schema`, `@response_schema` etc.) which define the input and output parameters of the endpoint. API URL paths are defined in the `register()` method and added to the Swagger page in the `post_process_routes()` method.
114114

115-
The API's should return the following HTTP status:
115+
The APIs should return the following HTTP status:
116116

117-
* HTTP 200 for successful API completion, with appropriate response
118-
* HTTP 400 (or appropriate 4xx code) (with an error message) for errors on input parameters (i.e. the user can retry with different parameters and potentially get a successful API call)
119-
* HTTP 404 if a record is expected and not found (generally for GET requests that fetch a single record)
120-
* HTTP 500 (or appropriate 5xx code) if there is some other processing error (i.e. won't make any difference what parameters the user tries) with an error message
117+
* HTTP 200 for successful API completion, with an appropriate response
118+
* HTTP 400 (or appropriate 4xx code) (with an error message) for errors on input parameters (i.e., the user can retry with different parameters and potentially get a successful API call)
119+
* HTTP 404 if a record is expected and not found (generally for GET requests that fetch a single record)
120+
* HTTP 500 (or appropriate 5xx code) if there is some other processing error (i.e., it won't make any difference what parameters the user tries) with an error message
121121

122-
.. and should not return:
122+
...and should not return:
123123

124-
* HTTP 500 with a stack trace due to untrapped error (we should handle error conditions with a 400 or 404 response, and catch errors and provide a meaningful error message)
124+
* HTTP 500 with a stack trace due to an untrapped error (we should handle error conditions with a 400 or 404 response and catch errors, providing a meaningful error message)

0 commit comments

Comments
 (0)