You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to RESTHeart Cloud's interactive documentation! Configure your connection details below to see personalized examples throughout the documentation.
Welcome to RESTHeart Cloud! This guide will walk you through setting up your first API and getting ready to use all the examples in our documentation.
17
14
18
-
Now that you've configured your connection details, you can follow along with the examples below. All code snippets will automatically use your configuration.
15
+
== Step 1: Sign Up for RESTHeart Cloud
19
16
20
-
== Basic Operations
17
+
First, create your free account and set up your API instance:
21
18
19
+
. *Visit https://cloud.restheart.com* and sign up for a free account
20
+
. *Create a new API* by clicking "Create API"
21
+
. *Choose the "Dev" tier* - it's completely free and perfect for getting started
22
+
. *Note your API URL* - it will look something like `https://705560.eu-west-1-test-free-1.restheart.com`
22
23
24
+
TIP: Keep the RESTHeart Cloud dashboard open in another tab - you'll need to copy some values from it in the next step.
23
25
24
-
==== JavaScript
26
+
== Step 2: Set Up Root User
25
27
26
-
[source,javascript]
27
-
----
28
-
fetch('[INSTANCE-URL]/mydb/mycollection', {
29
-
method: 'POST',
30
-
headers: {
31
-
'Authorization': 'Basic [BASIC-AUTH]',
32
-
'Content-Type': 'application/json'
33
-
},
34
-
body: JSON.stringify({
35
-
name: 'John',
36
-
age: 30
37
-
})
38
-
})
39
-
.then(response => {
40
-
if (response.ok) {
41
-
console.log('Document created successfully');
42
-
} else {
43
-
console.error('Failed to create document:', response.status);
44
-
}
45
-
})
46
-
.catch(error => console.error('Error:', error));
47
-
----
28
+
Before you can use your API, you need to create a root user with full privileges. This requires the Temporary Admin JWT from your cloud dashboard.
29
+
30
+
. *Get your Temporary Admin JWT* from the RESTHeart Cloud dashboard
31
+
. *Follow the root user setup guide*: link:/docs/cloud/root-user-setup[Root User Setup]
32
+
. *Create your root user* with username and password of your choice
33
+
34
+
WARNING: The Temporary Admin JWT is only valid for a short time and should only be used to create the root user.
35
+
36
+
== Step 3: Configure the Documentation Examples
48
37
49
-
=== Querying Documents
38
+
Now you're ready to use all the interactive examples throughout our documentation! Configure the documentation to point to your API:
50
39
51
-
Query documents using the `filter={<query>}` query parameter. :
40
+
. *Set your Instance URL* to your API URL (e.g., `https://705560.eu-west-1-test-free-1.restheart.com`)
41
+
. *Set your Username* to the root user you created
42
+
. *Set your Password* to the root user password you created
43
+
44
+
++++
45
+
{% include interactive-docs-config.html %}
46
+
++++
47
+
48
+
== Step 4: Test Your Setup
49
+
50
+
Let's verify everything is working by creating your first collection:
52
51
53
52
==== cURL
54
53
55
54
[source,bash]
56
55
----
57
-
curl -X GET "[INSTANCE-URL]/mydb/mycollection?filter={'age':{\$gt:25}}" \
console.error('Failed to create collection:', response.status);
83
+
}
83
84
})
84
85
.catch(error => console.error('Error:', error));
85
86
----
86
87
87
-
== Advanced Operations
88
+
If this returns a success response, congratulations! Your RESTHeart Cloud API is ready to use.
88
89
89
-
=== Bulk Operations
90
+
== What's Next?
90
91
91
-
Perform bulk insert POSTing an array of documents.
92
+
Now that your API is set up and configured, you can:
92
93
93
-
==== cURL
94
+
* *Explore Examples*: Check out link:/docs/cloud/examples[RESTHeart Cloud Examples] for real-world use cases
95
+
* *Learn the Basics*: Start with link:/docs/mongodb-rest/tutorial[MongoDB REST Tutorial]
96
+
* *Secure Your API*: Set up proper link:/docs/cloud/user-management[User Management] and link:/docs/cloud/security[Security]
97
+
* *Go Advanced*: Try link:/docs/mongodb-rest/aggregations[Aggregations], link:/docs/mongodb-websocket/examples[WebSockets], or link:/docs/mongodb-graphql/getting-started[GraphQL]
94
98
95
-
[source,bash]
96
-
----
97
-
curl -X POST [INSTANCE-URL]/mydb/mycollection \
98
-
-H "Authorization: Basic [BASIC-AUTH]" \
99
-
-H "Content-Type: application/json" \
100
-
-d '[
101
-
{"name": "Alice", "age": 25},
102
-
{"name": "Bob", "age": 35},
103
-
{"name": "Charlie", "age": 28}
104
-
]'
105
-
----
99
+
== Configuration Persistence
106
100
107
-
==== HTTPie
101
+
Your configuration settings (Instance URL, Username, Password) are saved in your browser and will persist across documentation pages. This means you can browse through all our interactive examples and they'll automatically use your RESTHeart Cloud API.
108
102
109
-
[source,bash]
110
-
----
111
-
echo '[
112
-
{"name": "Alice", "age": 25},
113
-
{"name": "Bob", "age": 35},
114
-
{"name": "Charlie", "age": 28}
115
-
]' | http POST [INSTANCE-URL]/mydb/mycollection \
116
-
Authorization:"Basic [BASIC-AUTH]" \
117
-
Content-Type:application/json
118
-
----
103
+
== Troubleshooting
119
104
120
-
==== JavaScript
105
+
*Authentication Issues*
121
106
122
-
[source,javascript]
123
-
----
124
-
const documents = [
125
-
{name: 'Alice', age: 25},
126
-
{name: 'Bob', age: 35},
127
-
{name: 'Charlie', age: 28}
128
-
];
129
-
130
-
fetch('[INSTANCE-URL]/mydb/mycollection', {
131
-
method: 'POST',
132
-
headers: {
133
-
'Authorization': 'Basic [BASIC-AUTH]',
134
-
'Content-Type': 'application/json'
135
-
},
136
-
body: JSON.stringify(documents)
137
-
})
138
-
.then(response => {
139
-
if (response.ok) {
140
-
console.log('Bulk documents created successfully');
141
-
} else {
142
-
console.error('Failed to create bulk documents:', response.status);
143
-
}
144
-
})
145
-
.catch(error => console.error('Error:', error));
146
-
----
107
+
- Make sure you completed the root user setup
108
+
- Verify your username and password are correct
109
+
- Check that your Instance URL doesn't have a trailing slash
147
110
148
-
=== Aggregation Pipeline
111
+
*Connection Issues*
149
112
150
-
==== cURL
113
+
- Confirm your API URL is correct (check the RESTHeart Cloud dashboard)
114
+
- Ensure your API instance is running (check the dashboard status)
151
115
152
-
[source,bash]
153
-
----
154
-
curl -X POST [INSTANCE-URL]/mydb/mycollection/_aggrs/pipeline \
0 commit comments