Metadata API reference

    Dapr has a metadata API that returns information about the sidecar allowing runtime discoverability. The metadata endpoint returns among other things, a list of the components loaded and the activated actors (if present).

    The Dapr metadata API also allows you to store additional information in the format of key-value pairs.

    Note: The Dapr metatada endpoint is for instance being used by the Dapr CLI when running dapr in standalone mode to store the PID of the process hosting the sidecar and the command used to run the application.

    Gets the Dapr sidecar information provided by the Metadata Endpoint.

    URL Parameters

    HTTP Response Codes

    CodeDescription
    200Metadata information returned
    500Dapr could not return the metadata information

    Metadata API Response Registered Actor

    NameTypeDescription
    typestringThe registered actor type.
    countintegerNumber of actors running.

    Metadata API Response Component

    Examples

    Note: This example is based on the Actor sample provided in the .

    Add a custom attribute to the Dapr sidecar information

    Adds a custom attribute to the Dapr sidecar information stored by the Metadata Endpoint.

    HTTP Request

      ParameterDescription
      daprPortThe Dapr port.
      attributeNameCustom attribute name. This is they key name in the key-value pair.

      HTTP Request Body

      Within the body of the request place the custom attribute value you want to store:

      1. attributeValue

      HTTP Response Codes

      Note: This example is based on the Actor sample provided in the Dapr SDK for Python.

      Add a custom attribute to the metadata endpoint:

      Get the metadata information to confirm your custom attribute was added:

      1. {
      2. "id":"demo-actor",
      3. "actors":[
      4. {
      5. "type":"DemoActor",
      6. "count":1
      7. ],
      8. "extended": {
      9. "myDemoAttribute": "myDemoAttributeValue",
      10. "cliPID":"1031040",
      11. "appCommand":"uvicorn --port 3000 demo_actor_service:app"
      12. "components":[
      13. {
      14. "type":"pubsub.redis",
      15. "version":""
      16. },
      17. {
      18. "name":"statestore",
      19. "type":"state.redis",
      20. "version":""
      21. }
      22. }