> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/sandbox/platform/architecture/sandbox-ui/low-level-design/sandbox-connector-bff.md).

# Sandbox Connector (BFF)

## Overview

The Sandbox Connector API serves as a Backend-for-Frontend (BFF) service that allows for bulk data creation, searching, and fetching within a registry. It provides endpoints to handle various data types and operations, such as actions, resources, and seed data. This design outlines the main components, their interactions, and the data flow within the API.

{% embed url="<https://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/DIGIT-Specs/sandbox/Common+Services/sandbox-bff.yaml>" %}
Sandbox BFF Spec
{% endembed %}

## **Components**

1. **API Gateway**
   * **Purpose**: Routes incoming requests to the appropriate backend services.
   * **Responsibilities**:
     * Authenticate and authorize requests.
     * Route requests to the respective endpoints in the Sandbox Connector service.
     * Aggregate responses from different services if needed.
2. **Sandbox Connector Service**
   * **Purpose**: Core service handling bulk data operations.
   * **Responsibilities**:
     * Manage bulk data creation, search, and retrieval.
     * Validate and process incoming data.
     * Interact with the data store to perform CRUD operations.
3. **Data Store**
   * **Purpose**: Store and manage data for the Sandbox Connector service.
   * **Responsibilities**:
     * Persist bulk uploaded data.
     * Store metadata and status information.
     * Support search and retrieval operations.

**API Endpoints**

1. **Bulk Data Creation**
   * **POST /sandbox-connector/v1/actions/\_get**
     * **Description**: Get the action data based on user roles.
     * **Request Body**:
       * `RequestInfo`: Metadata about the request.
       * `ActionDetails`: Details of the actions to be created.
     * **Responses**:
       * `200`: Successfully fetched action details.
       * `400`: Invalid input.
   * **POST /sandbox-connector/v1/data/\_create**
     * **Description**: Bulk upload of resource data based on type.
     * **Request Body**:
       * `RequestInfo`: Metadata about the request.
       * `ResourceDetails`: Details of the resources to be created.
     * **Responses**:
       * `200`: Successfully created resource details.
       * `400`: Invalid input.
   * **POST /sandbox-connector/v1/seed-data/\_create**
     * **Description**: Bulk upload of seed data based on type.
     * **Request Body**:
       * `RequestInfo`: Metadata about the request.
       * `EntityDetails`: Details of the entities to be created.
     * **Responses**:
       * `200`: Successfully created entity details.
       * `400`: Invalid input.

* **POST /sandbox-connector/v1/data/\_search**
  * **Description**: Search for API resources based on criteria.
    * **Request Body**:
      * `RequestInfo`: Metadata about the request.
      * `SearchCriteria`: Criteria to filter the search results.
    * **Responses**:
      * `200`: Successfully fetched search results.
      * `400`: Invalid input.

### API Sequence Diagrams

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td>Boundary Seed Data</td><td></td><td><a href="/sandbox/platform/architecture/sandbox-ui/low-level-design/modules/boundary-data-management.md#web-api-sequence-diagrams">Boundary Data Management</a></td></tr><tr><td></td><td>MDMS Seed Data</td><td></td><td><a href="/sandbox/platform/architecture/sandbox-ui/low-level-design/modules/boundary-data-management.md#web-api-sequence-diagrams">Boundary Data Management</a></td></tr><tr><td></td><td>Actions Get</td><td></td><td><a href="/sandbox/platform/architecture/sandbox-ui/low-level-design/modules/user-app.md">User App</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digit.org/sandbox/platform/architecture/sandbox-ui/low-level-design/sandbox-connector-bff.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
