Last updated: 2024-11-07 21:04:57.766737 File source: link on GitLab
The api package contains all API functionality of Device Management Service (DMS). DMS exposes various endpoints through which its different functionalities can be accessed.
Here is quick overview of the contents of this directory:
README: Current file which is aimed towards developers who wish to use and modify the api functionality.
api.go: This file contains router setup using Gin framework. It also applies Cross-Origin Resource Sharing (CORS) middleware and OpenTelemetry middleware for tracing. Further it lists down the endpoint URLs and the associated handler functions.
actor.go: Contains endpoints for actor interaction.
Configuration
The REST server by default binds to 127.0.0.1
on port 9999
. The configuration file dms_config.json
can be used to change to a different address and port.
The parameters rest.port
and rest.addr
define the port and the address respectively.
You can use the following format to construct the URL for accessing API endpoints
Currently, all endpoints are under the /actor
path
/actor/handle
Retrieve actor handle with ID, DID, and inbox address
Response:
/actor/send
Send a message to actor
The request should be an enveloped message
/actor/invoke
Invoke actor with message
The request should be an enveloped message
/actor/broadcast
Broadcast message to actors
The request should be an enveloped message
For more details on these Actor API endpoints, refer to the cmd/actor package on how the they are used.
Item | Value |
---|---|
Item | Value |
---|---|
Item | Value |
---|---|
Item | Value |
---|---|
endpoint:
/actor/handle
method:
HTTP GET
output:
Actor Handle
endpoint:
/actor/handle
method:
HTTP POST
output:
{"message": "message sent"}
endpoint:
/actor/invoke
method:
HTTP POST
output:
Enveloped Response or if error {"error": "<error message>"}
endpoint:
/actor/broadcast
method:
HTTP POST
output:
Enveloped Response or if error {"error": "<error message>"}