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
Introduced the ability to use configurable variables in API URLs, headers, and bodies for the remote-select plugin. Updated relevant service methods, configuration, and documentation to support this feature. Minor type and field adjustments were also applied for better consistency.
Resolved: #4
Copy file name to clipboardExpand all lines: README.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,41 @@ Advanced settings:
74
74
| Multi mode |`string`||
75
75
| Private field |`string`||
76
76
77
+
78
+
## Variables in API Requests
79
+
The plugin now supports using variables in your API URLs, headers, and request bodies.
80
+
This allows for dynamic configuration of your API requests.
81
+
82
+
### Setting up variables
83
+
Add variables to your plugin configuration in `config/plugins.js`:
84
+
85
+
```js
86
+
module.exports= {
87
+
"remote-select": {
88
+
enabled:true,
89
+
variables: {
90
+
apiBaseUrl:"https://api.example.com",
91
+
apiVersion:"v2",
92
+
authToken:"your-auth-token"
93
+
}
94
+
},
95
+
};
96
+
```
97
+
98
+
### Using variables
99
+
You can use variables in your configuration by surrounding the variable name with curly braces:
100
+
- In API URLs: `{apiBaseUrl}/products/{apiVersion}/list`
101
+
- In request headers: `Authorization: Bearer {authToken}`
102
+
- In request bodies: `{ "version": "{apiVersion}" }`
103
+
104
+
Variables provide a convenient way to:
105
+
- Manage environment-specific API endpoints
106
+
- Share authentication tokens across multiple select configurations
107
+
- Update common values in one place instead of modifying each select configuration
108
+
109
+
If a variable isn't defined in your configuration, the placeholder will remain unchanged in the request.
110
+
111
+
77
112
### Remote select input
78
113
79
114
Depends on `multi` option you will have in the model a single string from selected `value` option or array of selected `value` string.
@@ -169,3 +204,4 @@ and as a result, we have: (single mode)
169
204
multiple mode:
170
205
171
206

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "strapi-plugin-remote-select",
3
-
"version": "1.0.7",
3
+
"version": "1.0.8",
4
4
"description": "A powerful tool that adds select type inputs to your strapi with the ability to dynamically load options via API. Supports static and searchable endpoints—autocomplete.",
* Parses a string of headers into an object where each key is a header name and each value is the corresponding header value.
31
+
*
32
+
* @param [headers] - A string representing the headers, where each header is separated by a newline and the key-value pairs are separated by a colon.
33
+
* @return An object containing the parsed headers where the keys are the header names in lowercase, and the values are the corresponding header values.
0 commit comments