Supported by an active Community and Professional Services
Available under the Open Source AGPL and the Commercial License
MongoDB
RESTHeart is the leading Web API for MongoDB.
Just run it to open your MongoDb to the Web.
The API unlocks all the features of MongoDb, including queries, bulk updates, GridFs, aggregations, replica sets, sharding and more...
Fast Dev
No server side development is required and you can focus on building you application.
For complex cases, a simple and modern framework allows extending the API.
RESTHeart provides out-of-the-box User Authentication and Authorization
The Docker Container is available to get it up and running in minutes.
Fast & Light
High throughput check the performance tests.
Lightweight ~15Mb footprint, low RAM usage, starts instantly.
Horizontally Scalable with Stateless Architecture and full support for MongoDB replica sets and shards.
µService: it does one thing and it does it well.
Prod
High quality Documentation and active development Community.
Professional Services are available from SoftInstigate, the company behind RESTHeart.
For the Enterprise, the Commercial License overcomes the conditions of the AGPL.
Query documents from the command line with httpie.
The GET request has two query parameters: the query filter and pagesize to limit the response to two documents.
Here we use the brilliant httpie, a modern command line HTTP client.
$ http GET https://beta.mrest.io/demo/messages?filter='{"from":"Bob"}'\&pagesize=2 key:demo
HTTP/1.1 200 OK
# other response headers omitted
[
{
"_id": {
"$oid": "5b90101a198370e1dd7d0110"
},
"from": "Bob",
"message": "was here",
"timestamp": {
"$date": 1536167962446
}
},
{
"_id": {
"$oid": "5b49be10d418da78b75c3c2c"
},
"from": "Bob",
"message": "RESTHeart rocks",
"timestamp": {
"$date": 1531559440350
}
}
]Query documents from the command line with cURL.
The GET request has two query parameters: the query filter (that needs to be encoded with --data-urlencode option since it contains the curly brackets special chars) and pagesize to limit the response to two documents.
Here we use the immortal cURL!
$ curl --header "key:demo" -G --data-urlencode 'filter={"from":"Bob"}' https://beta.mrest.io/demo/messages?pagesize=2
[
{
"_id": {
"$oid": "5b90101a198370e1dd7d0110"
},
"message": "was here",
"from": "Bob",
"timestamp": {
"$date": 1536167962446
}
},
{
"_id": {
"$oid": "5b49be10d418da78b75c3c2c"
},
"message": "RESTHeart rocks",
"from": "Bob",
"timestamp": {
"$date": 1531559440350
}
}
]Query documents with JavaScript.
The GET request has two query parameters: the query filter and pagesize to limit the response to two documents.
Here we use the fetch API.
const url = encodeURI('https://beta.mrest.io/demo/messages?filter={"from":"Bob"}&pagesize=2');
fetch(url, { headers: {'key':'demo'} })
.then(response => response.json())
.then(function(data) {
console.log(JSON.stringify(data));
});Query documents with Java.
The GET request has two query parameters: the query filter and pagesize to limit the response to two documents.
Here we use the unirest java http library.
public void printOutMessages() throws UnirestException {
HttpResponse<JsonNode> resp = Unirest.get("https://beta.mrest.io/demo/messages")
.header("key", "demo")
.queryString("filter", "{\"from\":\"Bob\"}")
.queryString("pagesize", "2")
.asJson();
// get body as JSON array
JSONArray messages = resp.getBody().getArray();
// print out each message
messages.forEach(message -> System.out.println(message.toString()));
}Query documents with Swift.
The GET request has two query parameters: the query filter and pagesize to limit the response to two documents.
Here we use the JSONSerialization to parse the response body.
import UIKit
import PlaygroundSupport
var urlComponents = URLComponents(string: "https://beta.mrest.io/demo/messages")
// set the query parameters
var queryItems = [URLQueryItem]()
queryItems.append(URLQueryItem(name: "pagesize", value: "2"))
queryItems.append(URLQueryItem(name: "filter", value: "{\"from\":\"Bob\"}"))
urlComponents?.queryItems = queryItems
var urlRequest = URLRequest(url: (urlComponents?.url)!)
// set the key request header
urlRequest.setValue("demo", forHTTPHeaderField: "key")
// set request method
urlRequest.httpMethod = "GET"
URLSession.shared.dataTask(with: urlRequest) { (data, response, error) in
guard let dataResponse = data, error == nil
else {
print(error?.localizedDescription ?? "Response Error")
return
}
do {
let jsonResponse = try JSONSerialization.jsonObject(with: dataResponse, options: [])
print(jsonResponse)
} catch let jsonError {
print(jsonError)
}
}.resume()
// only needed in playground
PlaygroundPage.current.needsIndefiniteExecution = truePlease note that the examples use the mrest.io cloud service for RESTHeart. It requires the api key and has a slightly different representation format. See Representation Format for more information.
SUPPORTED BY AN ACTIVE COMMUNITY AND PROFESSIONAL SERVICES
Professional Services help you on using the RESTHeart standard API, developing RESTHeart extensions, customizing RESTHeart, priority bug fixing, configuration, best practices, etc...
PROFESSIONAL SERVICESAVAILABLE UNDER THE OPEN SOURCE AGPL AND THE COMMERCIAL LICENSE
RESTHeart is distributed under the Open Source GNU AGPL v3. If use of our product under the AGPL v3 does not satisfy your organization’s legal department, a commercial licenses is available.
Commercial license