> For the complete documentation index, see [llms.txt](https://docs.opshub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opshub.com/upcoming-release/mbse-connector-sdk-index/mbse-sdk-connector-apis/file-apis/file-get.md).

# Get File

## API Name

API Name: File – Get Content

***

## Overview

This API retrieves the content of a file from the end system.

MBSE Core uses this API to:

* Download file content for attached files
* Retrieve binary file data for synchronization
* Support file transfer between systems
* Stream file content directly without storing intermediate copies

Connector responsibility:

* Receive the `fileLocationUri`.
* Invoke the appropriate mechanism to obtain the file content from `fileLocationUri`.
* Return the content as an `InputStream`.
* Stream the file content.

This API is implemented as a pass-through operation.

***

### API URI

```bash
GET: /mbse/api/1.0/content
    ?projectId={projectId}
    &fileLocationUri={fileLocationUri}
```

***

### URI Parameters

| Name            | Mandatory | Type   | Description                                                 |
| --------------- | --------- | ------ | ----------------------------------------------------------- |
| projectId       | True      | String | ID of the project.                                          |
| fileLocationUri | True      | String | Content download URL or file path where the file is stored. |

***

### Connector Contract

Connector must implement:

```java
void getFileContent(String fileLocationUri)
```

#### Method Behavior

* Accept `fileLocationUri` as input.
* Return the content as `InputStream` in the servlet response.

***

### Behavior Rules

1. `projectId` must be validated before retrieving content.
2. `fileLocationUri` must be present.
3. File content should be streamed directly whenever possible.
4. Avoid loading entire files into memory for large files.
5. If file cannot be found:
   * Return HTTP `404 Not Found`
6. If access is denied:
   * Return HTTP `403 Forbidden`
7. If file retrieval fails:
   * Return HTTP `500 Internal Server Error`
8. Connector must close streams appropriately after transfer completion.

***

### Response Payload

#### Success Response

Binary stream response.

Example:

```http
HTTP/1.1 200 OK
Content-Type: application/octet-stream
```

Response body:

```
<binary file content>
```

***

### Response Headers

| Header         | Required | Description                     |
| -------------- | -------- | ------------------------------- |
| Content-Type   | False    | MIME type of file if available. |
| Content-Length | False    | File size in bytes.             |

***

### Example Use Case

#### Download File Content

```bash
GET /mbse/api/1.0/content?
projectId=123
&fileLocationUri=https://example.com/files/block-diagram.png
```

***

### Implementation Guidelines

* Do not transform or decode file bytes.
* Use streaming APIs where supported.
* Handle large files efficiently.
* Ensure streams are properly closed after transmission.

***


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.opshub.com/upcoming-release/mbse-connector-sdk-index/mbse-sdk-connector-apis/file-apis/file-get.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
