Launch the demo by running the following make target from project root directory.
make run-openapi-demo
Once both agents are up, click on the agent specific urls to launch the OpenAPI interface.
- On Alice agent, generate an invitation with
HTTP POST /connections/create-invitation
and copy the invitation from the response. Refer here for sample invitation json. - On Bob agent, save the invitation received from Alice with
HTTP POST /connections/receive-invitation
API. Note down the connection ID generated in the response. HTTP GET /connections/{id}
with the connection ID from the previous step fetches the new connection record. The state of this record should beinvited
. Refer here for sample response.- Also,
HTTP GET /connections
fetches all connection records. There should be one connection with state "invited". Refer here for sample response. - On Bob agent, accept the Invitation from Alice by sending connection ID with
HTTP POST /connections/{id}/accept-invitation
. After this, the state of the connection should be updated torequested
. - On Alice agent, fetch all connections with
HTTP GET /connections
. There will be one record with statusrequested
(request from Bob). Get the connection ID of this record. - On Alice agent, accept the Bob's request with
HTTP POST /connections/{id}/accept-request
API. - Calling
HTTP GET /connections/{id}
on both agents should show the connections with statecompleted
. Alice and Bob are now connected.
Prerequisite - There should be a connection between Alice and Bob.
-
On Alice agent, go to
HTTP POST /message/register-service
and register a "generic-invite" message service for type "https://didcomm.org/generic/1.0/message" and purpose "meeting, appointment and event" by using below input parameter.{ "name": "generic-invite", "purpose": [ "meeting,appointment,event" ], "type": "https://didcomm.org/generic/1.0/message" }
-
You can verify this new message service in alice agent by going to
HTTP GET /message/services
endpoint. -
To send a message to Alice, in Bob agent go to
HTTP POST /message/send
and send a meeting invite message of type "https://didcomm.org/generic/1.0/message" and purpose "meeting". Input argument will look like this,{ "connection_ID":"5975a122-efac-4d7a-9a43-569a68f2311f", "message_body":{ "@id":"2d071d1c-a47d-40e5-a0b7-f8234231ba9e", "@type":"https://didcomm.org/generic/1.0/message", "~purpose":["meeting"], "message":"Hey, meet me today at 4PM", "sender":"Bob"} }
Note: In above message,
Connection_ID
is sample connection id from existing connection with Alice. You can also usetheir_did
instead ofconnection_ID
in above message to select recipient of this message from you existing connections. -
Since REST API doesn't have mail box feature to list incoming messages, you can go to Alice agent's webhook url to see the topic/message just received by alice agent.
-
To unregister already registered message service, in alice agent go to
HTTP POST /message/unregister-service
and unregister "generic-invite" service by using below input parameter.{ "name": "generic-invite" }
Steps http over did comm message handling is same as above, but you can use HTTP POST /http-over-didcomm/register
to register http-over-didcomm message handlers.
To create public DID use HTTP POST /vdri/create-public-did
endpoint.
For example, to create a "sidetree" public DID in alice agent, go to HTTP POST /vdri/create-public-did
of alice agent and use below parameters.
method : sidetree
header : {"alg":"","kid":"","operation":"create"}
Following features are not supported at the moment in RestAPI.
- Connection search using different criterion.
- Reply to a message using
HTTP POST /message/reply
{
"serviceEndpoint":"http://alice.aries.example.com:8081",
"recipientKeys":[
"e3xUwgT9Qjb8KamK3kmvfRfmFf6LdYZMC6SeeV2oUnV"
],
"@id":"90c46677-27a0-41e1-a272-68eb15bb1984",
"label":"alice-agent",
"@type":"https://didcomm.org/didexchange/1.0/invitation"
}
{
"result":{
"ConnectionID":"d0d6b8b0-d0f7-4319-b3ef-671c9fa9f3a4",
"State":"invited",
"ThreadID":"a9c0cd4c-9edb-4ec5-b74d-7df524792fe7",
"TheirLabel":"alice-agent",
"ServiceEndPoint":"http://alice.aries.example.com:8081",
"RecipientKeys":[
"e3xUwgT9Qjb8KamK3kmvfRfmFf6LdYZMC6SeeV2oUnV"
],
"InvitationID":"90c46677-27a0-41e1-a272-68eb15bb1984",
"Namespace":"my"
}
}
{
"results":[
{
"ConnectionID":"d0d6b8b0-d0f7-4319-b3ef-671c9fa9f3a4",
"State":"invited",
"ThreadID":"a9c0cd4c-9edb-4ec5-b74d-7df524792fe7",
"TheirLabel":"alice-agent",
"TheirDID":"",
"MyDID":"",
"ServiceEndPoint":"http://alice.aries.example.com:8081",
"RecipientKeys":[
"e3xUwgT9Qjb8KamK3kmvfRfmFf6LdYZMC6SeeV2oUnV"
],
"InvitationID":"90c46677-27a0-41e1-a272-68eb15bb1984",
"Namespace":"my"
}
]
}