> For the complete documentation index, see [llms.txt](https://manual.docs.microstream.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.docs.microstream.one/4.0/data-store/rest-interface/setup.md).

# Setup

{% hint style="warning" %}
**This is the manual for older MicroStream versions (Version < 5.0).**

**The new documentation (Version >= 5.0) is located at:**

[https://docs.microstream.one/](https://docs.microstream.one/manual)
{% endhint %}

## REST Service

First of all we have to connect a storage to a REST service.&#x20;

Just add the REST service implementation to your dependencies, the logger is optional.

{% code title="pom.xml" %}

```markup
<repositories>
    <repository>
        <id>microstream-releases</id>
        <url>https://repo.microstream.one/repository/maven-public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>one.microstream</groupId>
        <artifactId>storage.restservice.sparkjava</artifactId>
        <version>04.00.00-MS-GA</version>
    </dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<version>1.7.30</version>
		</dependency>
</dependencies>
```

{% endcode %}

Now use the resolver to connect the service to a storage, start it, and you're good to go.

```java
EmbeddedStorageManager storage = EmbeddedStorage.start();
if(storage.root() == null)
{
		storage.setRoot(new Object[] {
				LocalDate.now(),
				X.List("a", "b", "c"),
				1337
		});
		storage.storeRoot();
}

StorageRestService service = StorageRestServiceResolver.resolve(storage);
service.start();
```

1\) An example storage manager\
12\) Create the REST service,\
13\) and start it.

That's all you have to do to open the REST endpoints to access the storage data.

The base URL of the opened endpoints is per default: <http://localhost:4567/microstream/>

{% hint style="info" %}
Internally, there is a REST adapter which opens access to the low-level storage data. This is used by the REST service layer, which is an abstract service interface. The default implementation of it, which uses [Sparkjava](http://sparkjava.com/), is used to open the REST endpoints. We just have to use this one to get started.
{% endhint %}

## Configuration

If you want to change the default port (4567) or instance name (microstream) it can be done by using the rest service implementation directly. The spark service can then be customized by your liking.

```java
StorageRestServiceSparkJava service = StorageRestServiceSparkJava.New(storage);
service.setSparkService(
		Service.ignite().port(80)
);
service.setInstanceName("my-name");
```

This will change the base URL to <http://localhost/my-name/>


---

# 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://manual.docs.microstream.one/4.0/data-store/rest-interface/setup.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.
