-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into see-all-relations-example
- Loading branch information
Showing
26 changed files
with
238 additions
and
43 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
sidebar_position: 5 | ||
sidebar_label: Connect via HTTP using cURL | ||
title: Connect via HTTP using cURL | Surreal Cloud | ||
description: Connect to your Surreal Cloud instance using the HTTP API and run queries. | ||
--- | ||
|
||
import Image from "@components/Image.astro"; | ||
|
||
import OpenInHTTPCurlLight from '@img/image/cloud/open-in-http.png'; | ||
import OpenInHTTPCurlDark from '@img/image/cloud/open-in-http.png'; | ||
|
||
# Connect via HTTP using cURL | ||
|
||
Surreal Cloud supports connection via HTTP. This allows you to connect to your Surreal Cloud Instance using curl or any HTTP client. To get started, select the **Connect** button on your Instance. Then select **HTTP cURL**. | ||
|
||
This will open a modal to fill in your credentials for **Namespace** and **Database** and authentication before you can copy the URL. | ||
|
||
|
||
<Image | ||
alt="Open in HTTP cURL" | ||
src={{ | ||
light: OpenInHTTPCurlLight, | ||
dark: OpenInHTTPCurlDark, | ||
}} | ||
/> | ||
|
||
|
||
> [!NOTE] | ||
> The URL provided can be used in any HTTP client, but by default it is set to use curl. Use the URL in your HTTP client to connect to your Surreal Cloud Instance from clients like Postman or any other HTTP client. | ||
## Connect to your Surreal Cloud Instance | ||
|
||
Once you have filled in the credentials, copy the URL and connect to your Surreal Cloud Instance. Below is an example of the connection URL in curl. | ||
|
||
```bash | ||
curl -X GET "https://cloud-demo-069qmb9jjttknc0djomp73flfs.aws-use1.surreal.cloud/version" | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
--- | ||
const result = await fetch( | ||
'https://search.maven.org/solrsearch/select?q=g:%22com.surrealdb%22+AND+a:%22surrealdb%22&wt=json' | ||
); | ||
const data = await result.json(); | ||
const version = data?.response?.docs[0]?.latestVersion ?? 'Unknown'; | ||
let version = 'Unknown'; | ||
try { | ||
const result = await fetch( | ||
'https://search.maven.org/solrsearch/select?q=g:%22com.surrealdb%22+AND+a:%22surrealdb%22&wt=json' | ||
); | ||
if (!result.ok) { | ||
throw new Error(`HTTP error! status: ${result.status}`); | ||
} | ||
const contentType = result.headers.get('content-type'); | ||
if (!contentType || !contentType.includes('application/json')) { | ||
throw new Error('Response is not JSON'); | ||
} | ||
const data = await result.json(); | ||
version = data?.response?.docs[0]?.latestVersion ?? 'Unknown'; | ||
} catch (error) { | ||
console.error('Error fetching version:', error); | ||
// Keep the default 'Unknown' value | ||
} | ||
--- | ||
|
||
<code>{version}</code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.