---
id: GetDashboardGrpc
name: Get catalog dashboard over gRPC
version: 1.0.0
badges:
  - content: Catalog Management
    backgroundColor: green
    textColor: green
summary: Returns Catalog totals and category counts through the admin-protected book.v1 gRPC contract.
owners:
  - catalog-experience-team
schemaPath: schema.proto
sidebar:
  badge: "gRPC"
---

`GetDashboardGrpc` invokes the admin-protected `book.v1.BookGrpcService/GetDashboard` gRPC unary RPC on [[service|catalog-api]] to retrieve total catalog book counts and per-category book counts. [[service|order-api]] calls this RPC with an exchanged Microsoft Entra ID administrator token when refreshing the Backoffice dashboard.

## Overview

| Property                           | Value                                                                                                                                         |
| :--------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- |
| **Bounded Context**                | Catalog                                                                                                                                       |
| **Owner Service**                  | [[service\|catalog-api]]                                                                                                                      |
| **Protocol / Format**              | gRPC unary RPC (`book.v1.BookGrpcService/GetDashboard`), Protobuf `edition = "2023"`                                                          |
| **Gateway Endpoint**               | Internal gRPC RPC `book.v1.BookGrpcService/GetDashboard` (not exposed via API Gateway)                                                        |
| **Authentication & Authorization** | Microsoft Entra ID JWT — `admin` policy (`admin` role and `catalog_read`/`catalog_write` scopes) via `Authorization: Bearer <token>` metadata |
| **Idempotency / Concurrency**      | Read-only and naturally idempotent                                                                                                            |
| **Rate Limit / Caching**           | Cached in L1 + Redis L2 for `15 seconds`                                                                                                      |
| **Contract Version**               | `1.0.0`                                                                                                                                       |

## Request & Response Contract

### Request Message (`GetDashboardRequest`)

Empty Protobuf message with no fields.

### Success Response (`GetDashboardResponse`)

| Name                 | Type                  | Required | Constraints          | Description                              |
| :------------------- | :-------------------- | :------- | :------------------- | :--------------------------------------- |
| `total_books`        | `int64`               | Yes      | Tag `1`; `>= 0`      | Sum of book counts across all categories |
| `categories`         | `DashboardCategory[]` | Yes      | Tag `2` (`repeated`) | Per-category book counts                 |
| `categories[].name`  | `string`              | Yes      | Tag `1`              | Category display name                    |
| `categories[].value` | `int64`               | Yes      | Tag `2`; `>= 0`      | Number of books assigned to the category |

## Behavior & Side Effects

- **Short-lived aggregation cache:** Aggregates book counts per category from PostgreSQL and caches the result for 15 seconds.
- **No state mutation:** Pure read RPC with no database writes or integration events.

## Error Responses

| Status / Code            | Condition                                                           | Client Recovery Action                                                |
| :----------------------- | :------------------------------------------------------------------ | :-------------------------------------------------------------------- |
| `Unauthenticated` (`16`) | Missing, expired, or invalid Entra ID bearer token in gRPC metadata | Exchange a valid administrator token scoped for Catalog API and retry |
| `PermissionDenied` (`7`) | Authenticated caller does not satisfy the `admin` policy            | Authenticate with an `admin` role principal                           |
| `Unavailable` (`14`)     | Catalog API is unreachable                                          | Retry within the budgeted resilience policy                           |

## Related Documentation

- [[service|catalog-api]] — Service overview, persistence, and gRPC services.
- [[service|order-api]] — Primary caller hosting the administrative dashboard.
- [[query|ListCategoriesGrpc]] — Anonymous gRPC category listing.

<NodeGraph />

<SchemaViewer
	file="schema.proto"
	title="Get catalog dashboard over gRPC schema"
	maxHeight="500"
	search="true"
/>


 ## Raw Schema:schema.proto

edition = "2023";

package book.v1;

service BookGrpcService {
  rpc GetDashboard (GetDashboardRequest) returns (GetDashboardResponse);
}

message GetDashboardRequest {}

message GetDashboardResponse {
  int64 total_books = 1;
  repeated DashboardCategory categories = 2;
}

message DashboardCategory {
  string name = 1;
  int64 value = 2;
}
