Skip to content

Commit 39d483b

Browse files
authored
Merge pull request #52 from ZennoLab/dev
docs: add URL encoding guidance for ZennoBrowser API and fix ZennoPoster navigation links
2 parents 29989dc + 252fdf4 commit 39d483b

6 files changed

Lines changed: 103 additions & 7 deletions

File tree

docs/ZennoBrowser/zb-public-API/getting-started-with-the-zennobrowser-api.mdx

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,51 @@ import DisclaimerNotice from '@site/src/components/DisclaimerNotice';
4545

4646
1. После удаления токена он будет продолжать работать ещё в течение 1,5–2 часов;
4747
2. После истечения срока действия токена он перестанет работать;
48-
3. Если вы потеряли ранее созданный токен, вы можете создать новый.
48+
3. Если вы потеряли ранее созданный токен, вы можете создать новый.
49+
50+
51+
---
52+
53+
## «Кодирование параметров (URL Encoding)»
54+
55+
### **Важно: Передача спецсимволов в значениях**
56+
57+
Если вы формируете запрос вручную (через `HttpClient`, `fetch` или `curl`), обязательно выполняйте **URL-encoding для значений** параметров.
58+
59+
В частности это касается параметра `screen=HD+`. Если не закодировать `+`, сервер интерпретирует его как пробел, и вы получите ошибку.
60+
61+
**Пример для `screen=HD+`:**
62+
63+
* **Неверно:** `.../create?screen=HD+`
64+
* **Верно:** `.../create?screen=HD%2B`
65+
66+
### **Таблица часто используемых символов**
67+
68+
Для корректной работы API следующие символы в **значениях параметров** должны быть заменены.
69+
70+
Кодируйте эти символы, только если они являются частью передаваемых данных (значений).
71+
72+
| Символ | Описание | Код (Encoded) |
73+
| :---- | :---- | :---- |
74+
| \+ | Плюс (как в HD+) | %2B |
75+
| | Пробел | %20 |
76+
| & | Амперсанд (разделитель параметров) | %26 |
77+
| \= | Равно | %3D |
78+
| ? | Знак вопроса | %3F |
79+
| / | Слэш | %2F |
80+
| : | Двоеточие | %3A |
81+
82+
### **Примеры реализации**
83+
84+
**C\# (HttpClient):** Вместо прямой склейки строк можно используйте метод `Uri.EscapeDataString()` для значения параметра, где могут быть спецсимволы.
85+
``` csharp
86+
string screen = "HD+";
87+
string url = $"http://localhost:8160/v1/profiles/create?name=ApiProfile&workspaceId=-1&screen={Uri.EscapeDataString(screen)}";
88+
// Результат: ...?screen=HD%2B
89+
```
90+
**Python (Requests):** Библиотека `requests` делает это автоматически, если передавать параметры словарем.
91+
``` Python
92+
params = {'screen': 'HD+'}
93+
response = requests.get('http://localhost:8160/v1/profiles/create', params=params)
94+
# Библиотека сама преобразует это в HD%2B
95+
```

docs/ZennoPoster/Hello/Key_Advantages.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
sidebar_position: 2
33
title: "Основные преимущества"
44
description: " "
@@ -42,7 +42,7 @@ ZennoPoster позволяет работать в браузере в мног
4242
## **Работа со списками, таблицами и не только**
4343

4444
В программу встроены средства для работы с:
45-
- ***[Таблицами](../ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Tables/Operations_on_Tables)***;
45+
- ***[Таблицами](/zennoposter/ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Tables/Operations_on_Tables)***;
4646
- ***[Google Таблицами](../ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Tables/Operations_on_Google_Sheets)***;
4747
- ***[Списками](../ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Lists/List_Operations)*** (xlsx, ods, csv, либо свой формат);
4848
- ***[Простыми файлами](../ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Data/Files)***;

docs/ZennoPoster/Hello/What_ZennoPoster_Consists_Of.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
sidebar_position: 5
33
title: "Из чего состоит ZennoPoster"
44
description: " "
@@ -32,7 +32,7 @@ _______________________________________________
3232
Также для создания шаблона важен режим записи действий, который добавляет в шаблон все ваши действия в браузере.
3333

3434
Помимо прочего в ProjectMaker можно работать с:
35-
- ***[Таблицами](../ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Tables/Operations_on_Tables)***;
35+
- ***[Таблицами](/zennoposter/ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Tables/Operations_on_Tables)***;
3636
- ***[Google Таблицами](../ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Tables/Operations_on_Google_Sheets)***;
3737
- ***[Списками](../ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Lists/List_Operations)*** (xlsx, ods, csv, либо свой формат);
3838
- ***[Простыми файлами](../ProjectMaker/Project-editor/Actions-in-ProjectMaker-Actions-Blocks/Data/Files)***;

i18n/en/docusaurus-plugin-content-docs-zennobrowser/current/zb-public-API/getting-started-with-the-zennobrowser-api.mdx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,52 @@ The API Token is required to execute all requests. It can obtained as follows:
4747
1. After deleting the token, it will continue functioning within 1.5-2 hours;
4848
2. After token has expired, it will cease to function;
4949
3. If you have lost a previously created token, you can create a new one.
50+
51+
## **Parameter Encoding (URL Encoding)**
52+
53+
### **Important: Passing special characters in parameter values**
54+
55+
If you construct HTTP requests manually (using `HttpClient`, `fetch`, `curl`, etc.), you **must URL-encode parameter values**.
56+
57+
This is especially important for parameters like `screen=HD+`.
58+
If the `+` character is not encoded, the server will interpret it as a **space**, which will result in an error.
59+
60+
**Example for `screen=HD+`**
61+
62+
* **Incorrect:** `.../create?screen=HD+`
63+
* **Correct:** `.../create?screen=HD%2B`
64+
65+
### Commonly Used Characters
66+
67+
For the API to work correctly, the following characters **must be encoded when they are part of parameter values**.
68+
69+
Encode these characters **only if they are part of the actual data (values)**, not as URL syntax.
70+
71+
| Character | Description | Encoded |
72+
| ----- | ----- | ----- |
73+
| `+` | Plus sign (e.g. `HD+`) | `%2B` |
74+
| (space) | Space | `%20` |
75+
| `&` | Ampersand (parameter separator) | `%26` |
76+
| `=` | Equals sign | `%3D` |
77+
| `?` | Question mark | `%3F` |
78+
| `/` | Slash | `%2F` |
79+
| `:` | Colon | `%3A` |
80+
81+
### Implementation Examples
82+
83+
**C# (HttpClient)**
84+
85+
Instead of manually concatenating strings, use `Uri.EscapeDataString()` for parameter values that may contain special characters.
86+
``` csharp
87+
string screen = "HD+";
88+
string url = $"http://localhost:8160/v1/profiles/create?name=ApiProfile&workspaceId=-1&screen={Uri.EscapeDataString(screen)}";
89+
// Result: ...?screen=HD%2B
90+
```
91+
**Python (Requests)**
92+
93+
The `requests` library automatically handles URL encoding when parameters are passed as a dictionary.
94+
``` Python
95+
params = {'screen': 'HD+'}
96+
response = requests.get('http://localhost:8160/v1/profiles/create',params=params)
97+
# The library automatically converts this to HD%2B
98+
```

i18n/en/docusaurus-plugin-content-docs-zennoposter/current/Hello/Key_Advantages.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
sidebar_position: 2
33
title: "Key Advantages"
44
description: " "

i18n/en/docusaurus-plugin-content-docs-zennoposter/current/Hello/What_ZennoPoster_Consists_Of.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
sidebar_position: 5
33
title: "What ZennoPoster Consists Of"
44
description: " "

0 commit comments

Comments
 (0)