Skip to content

Commit cd355db

Browse files
Openblocks-docsgitbook-bot
Openblocks-docs
authored andcommitted
GITBOOK-116: Add doc: REST APIs
1 parent e728044 commit cd355db

File tree

11 files changed

+81
-0
lines changed

11 files changed

+81
-0
lines changed

docs/.gitbook/assets/rest-api-1.png

207 KB
Loading

docs/.gitbook/assets/rest-api-2.png

147 KB
Loading

docs/.gitbook/assets/rest-api-3.png

49.4 KB
Loading

docs/.gitbook/assets/rest-api-4.png

140 KB
Loading

docs/.gitbook/assets/rest-api-5.png

522 KB
Loading

docs/.gitbook/assets/rest-api-6.png

133 KB
Loading

docs/.gitbook/assets/rest-api-7.png

133 KB
Loading

docs/.gitbook/assets/rest-api-8.png

137 KB
Loading

docs/.gitbook/assets/rest-api-9.png

125 KB
Loading

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* [Data source basics](data-sources/data-source-basics.md)
1414
* [Configure IP allowlists](data-sources/configure-ip-allowlists.md)
1515
* [Connect to APIs](data-sources/connect-to-databases/README.md)
16+
* [REST APIs](data-sources/connect-to-databases/rest-apis.md)
1617
* [Google Sheets](data-sources/connect-to-databases/google-sheets.md)
1718

1819
## Queries
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# REST APIs
2+
3+
## Connect REST API to Openblocks
4+
5+
Follow these steps to connect to REST APIs.
6+
7+
1. Click **Data Sources** on Openblocks homepage.
8+
2. Click **New Data Source** on the upper right. This permission is restricted to workspace admins and developers.
9+
3. Select **APIs** > **REST API**.
10+
11+
<figure><img src="../../.gitbook/assets/rest-api-1.png" alt=""><figcaption></figcaption></figure>
12+
4. Configure general settings. At a minimum, input **Name** and the base **URL** of the API to connect to. **Headers** and **Parameters** are optional. These are all common parameters that consist of URL query prefixes. For more information, see Make API requests.
13+
5. Configure **Authentication Type**.
14+
6. Click **Save**.
15+
16+
<figure><img src="../../.gitbook/assets/rest-api-2.png" alt=""><figcaption></figcaption></figure>
17+
18+
You can also connect to a new REST API data source when creating or editing queries in query library or query editor.
19+
20+
## Authentication type
21+
22+
The default authentication type is **None**. Other options are **Basic** and **Digest**, which require configuration of **Username** and **Password**.
23+
24+
<figure><img src="../../.gitbook/assets/rest-api-3.png" alt=""><figcaption></figcaption></figure>
25+
26+
If you need other customized authentication methods, contact our customer service on the homepage.
27+
28+
## SSL Cert Verification
29+
30+
In the advanced settings tab, you can configure SSL Cert Verification for your data sources. Three options are available: CA (Certificate Authority) Certificate, Self Signed Certificate, or Disabled. For security reasons, Openblocks accepts APIs with CA certificates by default. For APIs without CA certificates, you can either select "Verify Self Signed Cert" and enter the self-signed certificate or disable the SSL Cert verification.
31+
32+
<figure><img src="../../.gitbook/assets/rest-api-4.png" alt=""><figcaption></figcaption></figure>
33+
34+
Note that for self-signed certificate, the information should be provided in .[PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced\_Mail) (Privacy-Enhanced Mail) format. This certificate will be encrypted and stored securely in Openblocks.
35+
36+
<figure><img src="../../.gitbook/assets/rest-api-5.png" alt=""><figcaption></figcaption></figure>
37+
38+
## Forward Cookies
39+
40+
If you are self-hosting Openblocks in your own domain, you can make REST API requests with cookies to existing services under that domain. You can either toggle the option "Forward all cookies" or specify certain cookies to forward in the text box. This feature can be helpful in cases where you use cookies to share common context (like identity info in JWT format) across different services.
41+
42+
<figure><img src="../../.gitbook/assets/rest-api-6.png" alt=""><figcaption></figcaption></figure>
43+
44+
## Create a REST API query
45+
46+
You can create REST API queries in two ways:
47+
48+
* add a new data source and then create a query
49+
* create a query directly
50+
51+
Note that without creating a new data source, the REST API data source is not stored in your **Data Sources** and thus cannot be accessed to build other queries.
52+
53+
### Create a query with a new data source
54+
55+
Follow the steps to add a new REST API data source first and then create a query.
56+
57+
1. Connect REST API to access to.
58+
2. In the query editor, click **+ New**.
59+
3. Select the added API in **Data source**.&#x20;
60+
61+
<figure><img src="../../.gitbook/assets/rest-api-7.png" alt=""><figcaption></figcaption></figure>
62+
63+
64+
4. Enter URL, Headers, Parameters, and fill in other fields if needed.
65+
5. Click ▶ **Run**.
66+
67+
### Create a REST API query with predefined data source
68+
69+
Follow the steps to create a REST API query directly.
70+
71+
1. In the query editor, click **+ New**.
72+
2. Select **REST Query** in Data Sources. Openblocks offers this built-in plain data source so that you can quickly create REST API queries without adding a new data source first.&#x20;
73+
74+
<figure><img src="../../.gitbook/assets/rest-api-8.png" alt=""><figcaption></figcaption></figure>
75+
3. Enter URL, Query, Variables, Parameters, and fill in other fields if needed.
76+
77+
<figure><img src="../../.gitbook/assets/rest-api-9.png" alt=""><figcaption></figcaption></figure>
78+
79+
80+
4. Click ▶ **Run**.

0 commit comments

Comments
 (0)