[docs]: Update TJ API and Map Const w/ Env Var (#12102)

* Add Get All App ID

* Add Constant Mapping

* fix typo

* Update Formatting

* Update Version and Screenshot

* app id -> app details
This commit is contained in:
Pratik Agrawal 2025-03-05 10:32:50 +05:30 committed by GitHub
parent 44ea61f117
commit 2633286ec0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 290 additions and 104 deletions

View file

@ -1,8 +1,6 @@
---
id: workspace_constants
title: Workspace Constants and Secrets
---
Workspace constants and secrets are predefined values that can be used across your application to maintain consistency, facilitate easy updates, and securely store sensitive information. This document will guide you through the usage and management of workspace constants and secrets within your workspaces.
@ -150,6 +148,43 @@ Secrets cannot be used within the App Builder or workflows.
</div>
## Mapping Workspace Constants from Environment Variables
From version **`v3.5.8-ee-lts`**, you can use environment variables to set global and secret constants. Workspace constants set using environment variables will have a `.env` tag in front of them. If there are two constants with the same name, the one set through the environment variable will be used in the app builder, while the constant set through the UI will have a `duplicate` tag in front of it.
Users cannot edit or delete constants created from environment variables through the UI. To add, update, or delete any values from an environment variable, the container must be restarted.
<img className="screenshot-full" src="/img/workspace-const/const-mapping.png" alt="Mapping Workspace Constants from Environment Variables"/>
### Setting Global Constants
**Setting Individual Global Constant**
Syntax - `TOOLJET_GLOBAL_CONSTANTS__<environment>__constant_name`
Example - TOOLJET_GLOBAL_CONSTANTS__development__companyName = "Corp Pvt. Ltd."
**Setting Multiple Global Constants**
Syntax - `TOOLJET_GLOBAL_CONSTANTS__<environment> = {“name1”: “value1", “name2”: “value2"}`
Example - TOOLJET_GLOBAL_CONSTANTS__development = `{"company1": "corp.com", "company2": "example.com"}`
### Setting Secret Constants
**Setting Individual Global Constant**
Syntax - `TOOLJET_SECRET_CONSTANTS__<environment>__constant_name`
Example - TOOLJET_SECRET_CONSTANTS__development__apiKey = "agdagdagdg"
**Setting Multiple Global Constants**
Syntax - `TOOLJET_SECRET_CONSTANTS__<environment> = {“name1”: “value1", “name2”: “value2"}`
Example - TOOLJET_SECRET_CONSTANTS__development = `{"api_url": "https://api.example.com", "password" : "12345", "key" : "agdagdagdg"}`
<div style={{paddingBottom:'24px'}}>
## Best Practices

View file

@ -9,13 +9,14 @@ title: ToolJet API
ToolJet API allows you to interact with the ToolJet platform programmatically. You can use the APIs to manage users and their workspaces relations. The API endpoints are secured with an access token. You can perform various operations using the API such as:
- [Get All Users](#get-all-users)
- [Get All Workspaces](#get-all-workspaces)
- [Get All App Details](#get-all-app-details)
- [Get User by ID](#get-user-by-id)
- [Create User](#create-user)
- [Update User](#update-user)
- [Update User Role](#update-user-role)
- [Replace User Workspace](#replace-user-workspace)
- [Replace User Workspaces Relations](#replace-user-workspaces-relations)
- [Get All Workspaces](#get-all-workspaces)
- [Export Application](#export-application)
- [Import Application](#import-application)
@ -130,6 +131,112 @@ curl -X GET 'https://your-tooljet-instance.com/api/ext/users' \
```
</details>
### Get All Workspaces
- **Description:** Retrieves a list of all workspaces.
- **URL:** `/api/ext/workspaces`
- **Method:** GET
- **Authorization:** `Basic <access_token>`
- **Content-Type:** `application/json`
- **Response:** Array of Workspace objects.
<details>
<summary>Response Example</summary>
```json
[
{
"id": "a831db72-c3d2-4b36-a98e-0023ffb15e66",
"name": "demo-workspace",
"status": "active",
"groups": [
{
"id": "b3ae95dd-b1ca-4a21-abac-b321ee76698e",
"name": "all_users"
},
{
"id": "1830a113-24e5-4e33-8af2-e6502d477239",
"name": "admin"
}
]
},
{
"id": "b8a0c07d-2430-46fd-ba71-2a71e48fde30",
"name": "team-spac",
"status": "active",
"groups": [
{
"id": "7f7af977-a7e7-49e3-a08a-2dffce6f5942",
"name": "all_users"
},
{
"id": "eda68cf3-b70d-455f-8a2a-8cd4bbff77a6",
"name": "admin"
}
]
}
]
```
</details>
### Get All App Details
- **Description:** Get the app details for all the applications in the workspace.
- **URL:** `/api/ext/workspace/:workspace_id/apps`
- **Method:** GET
- **Authorization:** `Basic <access_token>`
- **Content-Type:** `application/json`
- **Params:**
- **workspace_id**: The ID of the workspace.
- **Response:** Array of app details for all the applications in the workspace.
<details>
<summary>**Response Example**</summary>
```json
[
{
"id": "ae06cc7a-2922-4fe7-9064-462741558813",
"name": "Applicant tracking system",
"slug": "ae06cc7a-2922-4fe7-9064-462741558813",
"versions": [
{
"id": "37be6442-ca1b-4a5a-a6f4-f929e00a0ac1",
"name": "v1"
},
{
"id": "be8a96c3-f7a4-4f82-b282-23678c52c973",
"name": "v3"
},
{
"id": "19405d8c-be75-47ad-aa96-36f2b1728e77",
"name": "v2"
},
{
"id": "15bd421d-54ce-44d5-8eef-39911fc2d4cb",
"name": "v4"
}
]
},
{
"id": "b68f87ca-6620-4cbf-83d6-becf073d8e96",
"name": "Aws Tracker",
"slug": "b68f87ca-6620-4cbf-83d6-becf073d8e96",
"versions": [
{
"id": "466a1cc4-62cf-4b46-b71d-114af61c04ca",
"name": "v1"
},
{
"id": "b65f1ae2-3702-4cba-91f3-3e5bddd55dbc",
"name": "v2"
}
]
}
]
```
</details>
### Get User by ID
- **Description:** Returns a user by their ID.
@ -351,55 +458,6 @@ curl -X GET 'https://your-tooljet-instance.com/api/ext/users' \
- **Note:** If no body is given or body is an empty object, it will not do anything.
- **Response:** `200 OK`
### Get All Workspaces
- **Description:** Retrieves a list of all workspaces.
- **URL:** `/api/ext/workspaces`
- **Method:** GET
- **Authorization:** `Basic <access_token>`
- **Content-Type:** `application/json`
- **Response:** Array of Workspace objects.
<details>
<summary>Response Example</summary>
```json
[
{
"id": "a831db72-c3d2-4b36-a98e-0023ffb15e66",
"name": "demo-workspace",
"status": "active",
"groups": [
{
"id": "b3ae95dd-b1ca-4a21-abac-b321ee76698e",
"name": "all_users"
},
{
"id": "1830a113-24e5-4e33-8af2-e6502d477239",
"name": "admin"
}
]
},
{
"id": "b8a0c07d-2430-46fd-ba71-2a71e48fde30",
"name": "team-spac",
"status": "active",
"groups": [
{
"id": "7f7af977-a7e7-49e3-a08a-2dffce6f5942",
"name": "all_users"
},
{
"id": "eda68cf3-b70d-455f-8a2a-8cd4bbff77a6",
"name": "admin"
}
]
}
]
```
</details>
### Export Application
From version **`v3.5.7-ee-lts`**, you can use ToolJet API to export application.

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

View file

@ -1,8 +1,6 @@
---
id: workspace_constants
title: Workspace Constants and Secrets
---
Workspace constants and secrets are predefined values that can be used across your application to maintain consistency, facilitate easy updates, and securely store sensitive information. This document will guide you through the usage and management of workspace constants and secrets within your workspaces.
@ -150,6 +148,43 @@ Secrets cannot be used within the App Builder or workflows.
</div>
## Mapping Workspace Constants from Environment Variables
From version **`v3.5.8-ee-lts`**, you can use environment variables to set global and secret constants. Workspace constants set using environment variables will have a `.env` tag in front of them. If there are two constants with the same name, the one set through the environment variable will be used in the app builder, while the constant set through the UI will have a `duplicate` tag in front of it.
Users cannot edit or delete constants created from environment variables through the UI. To add, update, or delete any values from an environment variable, the container must be restarted.
<img className="screenshot-full" src="/img/workspace-const/const-mapping.png" alt="Mapping Workspace Constants from Environment Variables"/>
### Setting Global Constants
**Setting Individual Global Constant**
Syntax - `TOOLJET_GLOBAL_CONSTANTS__<environment>__constant_name`
Example - TOOLJET_GLOBAL_CONSTANTS__development__companyName = "Corp Pvt. Ltd."
**Setting Multiple Global Constants**
Syntax - `TOOLJET_GLOBAL_CONSTANTS__<environment> = {“name1”: “value1", “name2”: “value2"}`
Example - TOOLJET_GLOBAL_CONSTANTS__development = `{"company1": "corp.com", "company2": "example.com"}`
### Setting Secret Constants
**Setting Individual Global Constant**
Syntax - `TOOLJET_SECRET_CONSTANTS__<environment>__constant_name`
Example - TOOLJET_SECRET_CONSTANTS__development__apiKey = "agdagdagdg"
**Setting Multiple Global Constants**
Syntax - `TOOLJET_SECRET_CONSTANTS__<environment> = {“name1”: “value1", “name2”: “value2"}`
Example - TOOLJET_SECRET_CONSTANTS__development = `{"api_url": "https://api.example.com", "password" : "12345", "key" : "agdagdagdg"}`
<div style={{paddingBottom:'24px'}}>
## Best Practices

View file

@ -9,13 +9,14 @@ title: ToolJet API
ToolJet API allows you to interact with the ToolJet platform programmatically. You can use the APIs to manage users and their workspaces relations. The API endpoints are secured with an access token. You can perform various operations using the API such as:
- [Get All Users](#get-all-users)
- [Get All Workspaces](#get-all-workspaces)
- [Get All App Details](#get-all-app-details)
- [Get User by ID](#get-user-by-id)
- [Create User](#create-user)
- [Update User](#update-user)
- [Update User Role](#update-user-role)
- [Replace User Workspace](#replace-user-workspace)
- [Replace User Workspaces Relations](#replace-user-workspaces-relations)
- [Get All Workspaces](#get-all-workspaces)
- [Export Application](#export-application)
- [Import Application](#import-application)
@ -130,6 +131,112 @@ curl -X GET 'https://your-tooljet-instance.com/api/ext/users' \
```
</details>
### Get All Workspaces
- **Description:** Retrieves a list of all workspaces.
- **URL:** `/api/ext/workspaces`
- **Method:** GET
- **Authorization:** `Basic <access_token>`
- **Content-Type:** `application/json`
- **Response:** Array of Workspace objects.
<details>
<summary>Response Example</summary>
```json
[
{
"id": "a831db72-c3d2-4b36-a98e-0023ffb15e66",
"name": "demo-workspace",
"status": "active",
"groups": [
{
"id": "b3ae95dd-b1ca-4a21-abac-b321ee76698e",
"name": "all_users"
},
{
"id": "1830a113-24e5-4e33-8af2-e6502d477239",
"name": "admin"
}
]
},
{
"id": "b8a0c07d-2430-46fd-ba71-2a71e48fde30",
"name": "team-spac",
"status": "active",
"groups": [
{
"id": "7f7af977-a7e7-49e3-a08a-2dffce6f5942",
"name": "all_users"
},
{
"id": "eda68cf3-b70d-455f-8a2a-8cd4bbff77a6",
"name": "admin"
}
]
}
]
```
</details>
### Get All App Details
- **Description:** Get the app details for all the applications in the workspace.
- **URL:** `/api/ext/workspace/:workspace_id/apps`
- **Method:** GET
- **Authorization:** `Basic <access_token>`
- **Content-Type:** `application/json`
- **Params:**
- **workspace_id**: The ID of the workspace.
- **Response:** Array of app details for all the applications in the workspace.
<details>
<summary>**Response Example**</summary>
```json
[
{
"id": "ae06cc7a-2922-4fe7-9064-462741558813",
"name": "Applicant tracking system",
"slug": "ae06cc7a-2922-4fe7-9064-462741558813",
"versions": [
{
"id": "37be6442-ca1b-4a5a-a6f4-f929e00a0ac1",
"name": "v1"
},
{
"id": "be8a96c3-f7a4-4f82-b282-23678c52c973",
"name": "v3"
},
{
"id": "19405d8c-be75-47ad-aa96-36f2b1728e77",
"name": "v2"
},
{
"id": "15bd421d-54ce-44d5-8eef-39911fc2d4cb",
"name": "v4"
}
]
},
{
"id": "b68f87ca-6620-4cbf-83d6-becf073d8e96",
"name": "Aws Tracker",
"slug": "b68f87ca-6620-4cbf-83d6-becf073d8e96",
"versions": [
{
"id": "466a1cc4-62cf-4b46-b71d-114af61c04ca",
"name": "v1"
},
{
"id": "b65f1ae2-3702-4cba-91f3-3e5bddd55dbc",
"name": "v2"
}
]
}
]
```
</details>
### Get User by ID
- **Description:** Returns a user by their ID.
@ -351,55 +458,6 @@ curl -X GET 'https://your-tooljet-instance.com/api/ext/users' \
- **Note:** If no body is given or body is an empty object, it will not do anything.
- **Response:** `200 OK`
### Get All Workspaces
- **Description:** Retrieves a list of all workspaces.
- **URL:** `/api/ext/workspaces`
- **Method:** GET
- **Authorization:** `Basic <access_token>`
- **Content-Type:** `application/json`
- **Response:** Array of Workspace objects.
<details>
<summary>Response Example</summary>
```json
[
{
"id": "a831db72-c3d2-4b36-a98e-0023ffb15e66",
"name": "demo-workspace",
"status": "active",
"groups": [
{
"id": "b3ae95dd-b1ca-4a21-abac-b321ee76698e",
"name": "all_users"
},
{
"id": "1830a113-24e5-4e33-8af2-e6502d477239",
"name": "admin"
}
]
},
{
"id": "b8a0c07d-2430-46fd-ba71-2a71e48fde30",
"name": "team-spac",
"status": "active",
"groups": [
{
"id": "7f7af977-a7e7-49e3-a08a-2dffce6f5942",
"name": "all_users"
},
{
"id": "eda68cf3-b70d-455f-8a2a-8cd4bbff77a6",
"name": "admin"
}
]
}
]
```
</details>
### Export Application
From version **`v3.5.7-ee-lts`**, you can use ToolJet API to export application.