@lowdefy/connection-axios-http 0.0.0-experimental-20250915134255 → 0.0.0-experimental-20251010122007
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
<TITLE>
|
|
2
|
+
AxiosHttp
|
|
3
|
+
</TITLE>
|
|
4
|
+
|
|
5
|
+
<DESCRIPTION>
|
|
6
|
+
|
|
7
|
+
### Properties
|
|
8
|
+
|
|
9
|
+
- `url: string`: The server URL that will be used for the request.
|
|
10
|
+
- `method: enum`: Default: `'get'` - The request method to be used when making the request. Options are:
|
|
11
|
+
- `'get'`
|
|
12
|
+
- `'delete'`
|
|
13
|
+
- `'head'`
|
|
14
|
+
- `'options'`
|
|
15
|
+
- `'post'`
|
|
16
|
+
- `'put'`
|
|
17
|
+
- `'patch'`
|
|
18
|
+
- `baseURL: string`: `baseURL` will be prepended to `url` unless `url` is absolute. It can be convenient to set `baseURL` for an axios connection to pass relative URLs to requests or mutations using that connection.
|
|
19
|
+
- `headers: object`: An object with custom headers to be sent sent with the request. The object keys should be header names, and the values should be the string header values.
|
|
20
|
+
- `params: object`: An object with URL parameters to be sent with the request.
|
|
21
|
+
- `data: string | object | array`: The data to be sent as the request body. Only applicable for request methods `'put'`, `'post'`, and `'patch'`. Can be an object, array or a string in the format `'Country=Brasil&City=Belo Horizonte'`.
|
|
22
|
+
- `auth: object`: Indicates that HTTP Basic authorization should be used, and supplies credentials. This will set an `Authorization` header, overwriting any existing `Authorization` custom headers you have set using `headers`. Only HTTP Basic auth is configurable through this parameter, for Bearer tokens and such, use `Authorization` custom headers instead. The `auth` object should have the following fields:
|
|
23
|
+
- `username: string`
|
|
24
|
+
- `password: string`
|
|
25
|
+
- `httpAgentOptions: object`: Options to pass to the Node.js [`http.Agent`](https://nodejs.org/api/http.html#http_class_http_agent) class.
|
|
26
|
+
- `httpsAgentOptions: object`: Options to pass to the Node.js [`https.Agent`](https://nodejs.org/api/http.html#http_class_http_agent) class.
|
|
27
|
+
- `maxContentLength: number`: Defines the max size of the http response content allowed in bytes.
|
|
28
|
+
- `maxRedirects: number`: Defines the maximum number of redirects to follow. If set to 0, no redirects will be followed.
|
|
29
|
+
- `proxy: object`: Defines the hostname and port of the proxy server. The `proxy` object should have the following fields:
|
|
30
|
+
- `host: string`: Host IP address (eg. `'127.0.0.1'`).
|
|
31
|
+
- `port: number`: Port number.
|
|
32
|
+
- `auth: object`: Object with username and password.
|
|
33
|
+
- `responseType: enum`: Default: `'json'` - The type of data that the server will respond with. Options are:
|
|
34
|
+
- `'document'`
|
|
35
|
+
- `'json'`
|
|
36
|
+
- `'text'`
|
|
37
|
+
- `responseEncoding: string`: Default: `'utf8'` - Indicates encoding to use for decoding responses.
|
|
38
|
+
- `timeout: number`: Default: `0` (no timeout) - The number of milliseconds before the request times out. If the request takes longer than `timeout`, the request will be aborted. Set to `0` for no timeout.
|
|
39
|
+
- `transformRequest: function`: A function to transform the request data before it is sent. Receives `data` and `headers` as arguments and should return the data to be sent.
|
|
40
|
+
- `transformResponse: function`: A function to transform the received data. Receives `data` as an argument and should return the transformed data.
|
|
41
|
+
- `validateStatus: function`: A function to validate whether the response should complete successfully given a status code. Receives `status` as an argument and should `true` if the status code is valid.
|
|
42
|
+
|
|
43
|
+
</DESCRIPTION>
|
|
44
|
+
|
|
45
|
+
<CONNECTION>
|
|
46
|
+
AxiosHttp
|
|
47
|
+
</CONNECTION>
|
|
48
|
+
|
|
49
|
+
<SCHEMA>
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
export default {
|
|
53
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
54
|
+
title: 'Lowdefy Connection Schema - AxiosHttp',
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
url: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'The server URL that will be used for the request.',
|
|
60
|
+
errorMessage: {
|
|
61
|
+
type: 'AxiosHttp property "url" should be a string.',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
method: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
enum: ['get', 'delete', 'head', 'options', 'post', 'put', 'patch'],
|
|
67
|
+
description: 'The request method to be used when making the request',
|
|
68
|
+
errorMessage: {
|
|
69
|
+
type: 'AxiosHttp property "method" should be a string.',
|
|
70
|
+
enum: 'AxiosHttp property "method" is not a valid value.',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
baseURL: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
description:
|
|
76
|
+
'baseURL will be prepended to url unless url is absolute. It can be convenient to set baseURL for an axios connection so that requests can use relative urls.',
|
|
77
|
+
errorMessage: {
|
|
78
|
+
type: 'AxiosHttp property "baseURL" should be a string.',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
headers: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
description:
|
|
84
|
+
'An object with custom headers to be sent with the request. The object keys should be header names, and the values should be the string header values.',
|
|
85
|
+
errorMessage: {
|
|
86
|
+
type: 'AxiosHttp property "headers" should be an object.',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
params: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
description: 'An object with URL parameters to be sent with the request.',
|
|
92
|
+
errorMessage: {
|
|
93
|
+
type: 'AxiosHttp property "params" should be an object.',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
data: {
|
|
97
|
+
description:
|
|
98
|
+
"The data to be sent as the request body. Only applicable for request methods 'put', 'post', and 'patch'. Can be an object, array or a string in the format 'Country=USA&City=New York'.",
|
|
99
|
+
},
|
|
100
|
+
timeout: {
|
|
101
|
+
type: 'number',
|
|
102
|
+
description:
|
|
103
|
+
'The number of milliseconds before the request times out. If the request takes longer than timeout, the request will be aborted. Set to 0 for no timeout.',
|
|
104
|
+
default: 0,
|
|
105
|
+
errorMessage: {
|
|
106
|
+
type: 'AxiosHttp property "timeout" should be a number.',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
auth: {
|
|
110
|
+
type: 'object',
|
|
111
|
+
description:
|
|
112
|
+
'Indicates that HTTP Basic authorization should be used, and supplies credentials. This will set an Authorization header, overwriting any existing Authorization custom headers you have set using headers. Only HTTP Basic auth is configurable through this parameter, for Bearer tokens and such, use Authorization custom headers instead.',
|
|
113
|
+
properties: {
|
|
114
|
+
username: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
description: 'HTTP Basic authorization username.',
|
|
117
|
+
errorMessage: {
|
|
118
|
+
type: 'AxiosHttp property "auth.username" should be a string.',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
password: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: 'HTTP Basic authorization password.',
|
|
124
|
+
errorMessage: {
|
|
125
|
+
type: 'AxiosHttp property "auth.password" should be a string.',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
errorMessage: {
|
|
130
|
+
type: 'AxiosHttp property "auth" should be an object.',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
responseType: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
enum: ['json', 'document', 'text'],
|
|
136
|
+
description: 'The type of data that the server should respond with.',
|
|
137
|
+
default: 'json',
|
|
138
|
+
errorMessage: {
|
|
139
|
+
type: 'AxiosHttp property "responseType" should be a string.',
|
|
140
|
+
enum: 'AxiosHttp property "responseType" is not a valid value.',
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
responseEncoding: {
|
|
144
|
+
type: 'string',
|
|
145
|
+
description: 'Indicates encoding to use for decoding responses.',
|
|
146
|
+
default: 'utf8',
|
|
147
|
+
errorMessage: {
|
|
148
|
+
type: 'AxiosHttp property "responseEncoding" should be a string.',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
maxContentLength: {
|
|
152
|
+
type: 'number',
|
|
153
|
+
description: 'Defines the max size of the http response content allowed in bytes.',
|
|
154
|
+
errorMessage: {
|
|
155
|
+
type: 'AxiosHttp property "maxContentLength" should be a number.',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
maxRedirects: {
|
|
159
|
+
type: 'number',
|
|
160
|
+
description:
|
|
161
|
+
'Defines the maximum number of redirects to follow. If set to 0, no redirects will be followed.',
|
|
162
|
+
default: 5,
|
|
163
|
+
errorMessage: {
|
|
164
|
+
type: 'AxiosHttp property "maxRedirects" should be a number.',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
proxy: {
|
|
168
|
+
type: 'object',
|
|
169
|
+
description: 'Defines the hostname and port of the proxy server.',
|
|
170
|
+
errorMessage: {
|
|
171
|
+
type: 'AxiosHttp property "proxy" should be an object.',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
</SCHEMA>
|
|
179
|
+
|
|
180
|
+
<EXAMPLES>
|
|
181
|
+
|
|
182
|
+
Properties for a AxiosHttp can be set on either the connection, the request, or both. However, both a connection and request need to be defined.
|
|
183
|
+
|
|
184
|
+
### A basic full example requesting data from https://jsonplaceholder.typicode.com
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
lowdefy: {{ version }}
|
|
188
|
+
name: Lowdefy starter
|
|
189
|
+
connections:
|
|
190
|
+
- id: my_api
|
|
191
|
+
type: AxiosHttp
|
|
192
|
+
properties:
|
|
193
|
+
baseURL: https://jsonplaceholder.typicode.com
|
|
194
|
+
pages:
|
|
195
|
+
- id: welcome
|
|
196
|
+
type: PageHeaderMenu
|
|
197
|
+
requests:
|
|
198
|
+
- id: get_posts
|
|
199
|
+
type: AxiosHttp
|
|
200
|
+
connectionId: my_api
|
|
201
|
+
properties:
|
|
202
|
+
url: /posts
|
|
203
|
+
events:
|
|
204
|
+
onInit:
|
|
205
|
+
- id: fetch_get_posts
|
|
206
|
+
type: Request
|
|
207
|
+
params: get_posts
|
|
208
|
+
blocks:
|
|
209
|
+
- id: rest_data
|
|
210
|
+
type: Markdown
|
|
211
|
+
properties:
|
|
212
|
+
content:
|
|
213
|
+
_string.concat:
|
|
214
|
+
- |
|
|
215
|
+
```yaml
|
|
216
|
+
- _yaml.stringify:
|
|
217
|
+
- _request: get_posts
|
|
218
|
+
- |
|
|
219
|
+
```
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Using the connection to set baseURL and authorization, and handle specific requests as requests
|
|
223
|
+
|
|
224
|
+
```yaml
|
|
225
|
+
connections:
|
|
226
|
+
- id: app_api
|
|
227
|
+
type: AxiosHttp
|
|
228
|
+
properties:
|
|
229
|
+
baseURL: app.com/api
|
|
230
|
+
auth:
|
|
231
|
+
username: api_user
|
|
232
|
+
password:
|
|
233
|
+
_secret: API_PASSWORD
|
|
234
|
+
# ...
|
|
235
|
+
requests:
|
|
236
|
+
- id: get_orders
|
|
237
|
+
type: AxiosHttp
|
|
238
|
+
connectionId: app_api
|
|
239
|
+
properties:
|
|
240
|
+
url: /orders
|
|
241
|
+
- id: update_order
|
|
242
|
+
type: AxiosHttp
|
|
243
|
+
connectionId: app_api
|
|
244
|
+
payload:
|
|
245
|
+
order_id:
|
|
246
|
+
_state: order_id
|
|
247
|
+
data:
|
|
248
|
+
_state: true
|
|
249
|
+
properties:
|
|
250
|
+
url:
|
|
251
|
+
_nunjucks:
|
|
252
|
+
template: /orders/{{ order_id }}
|
|
253
|
+
on:
|
|
254
|
+
order_id:
|
|
255
|
+
_payload: order_id
|
|
256
|
+
method: post
|
|
257
|
+
data:
|
|
258
|
+
_payload: data
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Setting properties on only the connection
|
|
262
|
+
|
|
263
|
+
```yaml
|
|
264
|
+
connections:
|
|
265
|
+
- id: get_count
|
|
266
|
+
type: AxiosHttp
|
|
267
|
+
properties:
|
|
268
|
+
url: myapp.com/api/count
|
|
269
|
+
headers:
|
|
270
|
+
X-Api-Key:
|
|
271
|
+
_secret: API_KEY
|
|
272
|
+
# ...
|
|
273
|
+
requests:
|
|
274
|
+
- id: get_count
|
|
275
|
+
type: AxiosHttp
|
|
276
|
+
connectionId: get_count
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Setting properties on only the request, and using a generic connection
|
|
280
|
+
|
|
281
|
+
```yaml
|
|
282
|
+
connections:
|
|
283
|
+
- id: axios
|
|
284
|
+
type: AxiosHttp
|
|
285
|
+
# ...
|
|
286
|
+
requests:
|
|
287
|
+
- id: get_api_1
|
|
288
|
+
type: AxiosHttp
|
|
289
|
+
connectionId: axios
|
|
290
|
+
properties:
|
|
291
|
+
url: app1.com/api/things
|
|
292
|
+
- id: post_to_api_2
|
|
293
|
+
type: AxiosHttp
|
|
294
|
+
connectionId: axios
|
|
295
|
+
payload:
|
|
296
|
+
data:
|
|
297
|
+
_state: true
|
|
298
|
+
properties:
|
|
299
|
+
url: api.otherapp.org/other/thing
|
|
300
|
+
method: post
|
|
301
|
+
data:
|
|
302
|
+
_payload: data
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
</EXAMPLES>
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
<TITLE>
|
|
2
|
+
AxiosHttp
|
|
3
|
+
</TITLE>
|
|
4
|
+
|
|
5
|
+
<DESCRIPTION>
|
|
6
|
+
|
|
7
|
+
The `AxiosHttp` connection is used to connect to APIs and web servers using HTTP or HTTPS.
|
|
8
|
+
|
|
9
|
+
It uses the [axios](https://github.com/axios/axios) library.
|
|
10
|
+
|
|
11
|
+
The same properties can be set on both connections and requests. The properties will be merged, with the request properties overwriting connection properties. This allows properties like authentication headers and the baseURL to be set on the connection, with request specific properties like the request.
|
|
12
|
+
|
|
13
|
+
>Secrets like authentication headers and API keys should be stored using the [`_secret`](_secret) operator.
|
|
14
|
+
|
|
15
|
+
</DESCRIPTION>
|
|
16
|
+
|
|
17
|
+
<REQUESTS>
|
|
18
|
+
|
|
19
|
+
- AxiosHttp
|
|
20
|
+
|
|
21
|
+
</REQUESTS>
|
|
22
|
+
|
|
23
|
+
<SCHEMA>
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
export default {
|
|
27
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
28
|
+
title: 'Lowdefy Connection Schema - AxiosHttp',
|
|
29
|
+
type: 'object',
|
|
30
|
+
properties: {
|
|
31
|
+
url: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'The server URL that will be used for the request.',
|
|
34
|
+
errorMessage: {
|
|
35
|
+
type: 'AxiosHttp property "url" should be a string.',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
method: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
enum: ['get', 'delete', 'head', 'options', 'post', 'put', 'patch'],
|
|
41
|
+
description: 'The request method to be used when making the request',
|
|
42
|
+
errorMessage: {
|
|
43
|
+
type: 'AxiosHttp property "method" should be a string.',
|
|
44
|
+
enum: 'AxiosHttp property "method" is not a valid value.',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
baseURL: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description:
|
|
50
|
+
'baseURL will be prepended to url unless url is absolute. It can be convenient to set baseURL for an axios connection so that requests can use relative urls.',
|
|
51
|
+
errorMessage: {
|
|
52
|
+
type: 'AxiosHttp property "baseURL" should be a string.',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
headers: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
description:
|
|
58
|
+
'An object with custom headers to be sent with the request. The object keys should be header names, and the values should be the string header values.',
|
|
59
|
+
errorMessage: {
|
|
60
|
+
type: 'AxiosHttp property "headers" should be an object.',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
params: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
description: 'An object with URL parameters to be sent with the request.',
|
|
66
|
+
errorMessage: {
|
|
67
|
+
type: 'AxiosHttp property "params" should be an object.',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
data: {
|
|
71
|
+
description:
|
|
72
|
+
"The data to be sent as the request body. Only applicable for request methods 'put', 'post', and 'patch'. Can be an object, array or a string in the format 'Country=USA&City=New York'.",
|
|
73
|
+
},
|
|
74
|
+
timeout: {
|
|
75
|
+
type: 'number',
|
|
76
|
+
description:
|
|
77
|
+
'The number of milliseconds before the request times out. If the request takes longer than timeout, the request will be aborted. Set to 0 for no timeout.',
|
|
78
|
+
default: 0,
|
|
79
|
+
errorMessage: {
|
|
80
|
+
type: 'AxiosHttp property "timeout" should be a number.',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
auth: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
description:
|
|
86
|
+
'Indicates that HTTP Basic authorization should be used, and supplies credentials. This will set an Authorization header, overwriting any existing Authorization custom headers you have set using headers. Only HTTP Basic auth is configurable through this parameter, for Bearer tokens and such, use Authorization custom headers instead.',
|
|
87
|
+
properties: {
|
|
88
|
+
username: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
description: 'HTTP Basic authorization username.',
|
|
91
|
+
errorMessage: {
|
|
92
|
+
type: 'AxiosHttp property "auth.username" should be a string.',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
password: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
description: 'HTTP Basic authorization password.',
|
|
98
|
+
errorMessage: {
|
|
99
|
+
type: 'AxiosHttp property "auth.password" should be a string.',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
errorMessage: {
|
|
104
|
+
type: 'AxiosHttp property "auth" should be an object.',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
responseType: {
|
|
108
|
+
type: 'string',
|
|
109
|
+
enum: ['json', 'document', 'text'],
|
|
110
|
+
description: 'The type of data that the server should respond with.',
|
|
111
|
+
default: 'json',
|
|
112
|
+
errorMessage: {
|
|
113
|
+
type: 'AxiosHttp property "responseType" should be a string.',
|
|
114
|
+
enum: 'AxiosHttp property "responseType" is not a valid value.',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
responseEncoding: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
description: 'Indicates encoding to use for decoding responses.',
|
|
120
|
+
default: 'utf8',
|
|
121
|
+
errorMessage: {
|
|
122
|
+
type: 'AxiosHttp property "responseEncoding" should be a string.',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
maxContentLength: {
|
|
126
|
+
type: 'number',
|
|
127
|
+
description: 'Defines the max size of the http response content allowed in bytes.',
|
|
128
|
+
errorMessage: {
|
|
129
|
+
type: 'AxiosHttp property "maxContentLength" should be a number.',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
maxRedirects: {
|
|
133
|
+
type: 'number',
|
|
134
|
+
description:
|
|
135
|
+
'Defines the maximum number of redirects to follow. If set to 0, no redirects will be followed.',
|
|
136
|
+
default: 5,
|
|
137
|
+
errorMessage: {
|
|
138
|
+
type: 'AxiosHttp property "maxRedirects" should be a number.',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
proxy: {
|
|
142
|
+
type: 'object',
|
|
143
|
+
description: 'Defines the hostname and port of the proxy server.',
|
|
144
|
+
errorMessage: {
|
|
145
|
+
type: 'AxiosHttp property "proxy" should be an object.',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
</SCHEMA>
|
|
153
|
+
|
|
154
|
+
<EXAMPLES>
|
|
155
|
+
|
|
156
|
+
Properties for a AxiosHttp can be set on either the connection, the request, or both. However, both a connection and request need to be defined.
|
|
157
|
+
|
|
158
|
+
### A basic full example requesting data from https://jsonplaceholder.typicode.com
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
lowdefy: {{ version }}
|
|
162
|
+
name: Lowdefy starter
|
|
163
|
+
connections:
|
|
164
|
+
- id: my_api
|
|
165
|
+
type: AxiosHttp
|
|
166
|
+
properties:
|
|
167
|
+
baseURL: https://jsonplaceholder.typicode.com
|
|
168
|
+
pages:
|
|
169
|
+
- id: welcome
|
|
170
|
+
type: PageHeaderMenu
|
|
171
|
+
requests:
|
|
172
|
+
- id: get_posts
|
|
173
|
+
type: AxiosHttp
|
|
174
|
+
connectionId: my_api
|
|
175
|
+
properties:
|
|
176
|
+
url: /posts
|
|
177
|
+
events:
|
|
178
|
+
onInit:
|
|
179
|
+
- id: fetch_get_posts
|
|
180
|
+
type: Request
|
|
181
|
+
params: get_posts
|
|
182
|
+
blocks:
|
|
183
|
+
- id: rest_data
|
|
184
|
+
type: Markdown
|
|
185
|
+
properties:
|
|
186
|
+
content:
|
|
187
|
+
_string.concat:
|
|
188
|
+
- |
|
|
189
|
+
```yaml
|
|
190
|
+
- _yaml.stringify:
|
|
191
|
+
- _request: get_posts
|
|
192
|
+
- |
|
|
193
|
+
```
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Using the connection to set baseURL and authorization, and handle specific requests as requests
|
|
197
|
+
|
|
198
|
+
```yaml
|
|
199
|
+
connections:
|
|
200
|
+
- id: app_api
|
|
201
|
+
type: AxiosHttp
|
|
202
|
+
properties:
|
|
203
|
+
baseURL: app.com/api
|
|
204
|
+
auth:
|
|
205
|
+
username: api_user
|
|
206
|
+
password:
|
|
207
|
+
_secret: API_PASSWORD
|
|
208
|
+
# ...
|
|
209
|
+
requests:
|
|
210
|
+
- id: get_orders
|
|
211
|
+
type: AxiosHttp
|
|
212
|
+
connectionId: app_api
|
|
213
|
+
properties:
|
|
214
|
+
url: /orders
|
|
215
|
+
- id: update_order
|
|
216
|
+
type: AxiosHttp
|
|
217
|
+
connectionId: app_api
|
|
218
|
+
payload:
|
|
219
|
+
order_id:
|
|
220
|
+
_state: order_id
|
|
221
|
+
data:
|
|
222
|
+
_state: true
|
|
223
|
+
properties:
|
|
224
|
+
url:
|
|
225
|
+
_nunjucks:
|
|
226
|
+
template: /orders/{{ order_id }}
|
|
227
|
+
on:
|
|
228
|
+
order_id:
|
|
229
|
+
_payload: order_id
|
|
230
|
+
method: post
|
|
231
|
+
data:
|
|
232
|
+
_payload: data
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Setting properties on only the connection
|
|
236
|
+
|
|
237
|
+
```yaml
|
|
238
|
+
connections:
|
|
239
|
+
- id: get_count
|
|
240
|
+
type: AxiosHttp
|
|
241
|
+
properties:
|
|
242
|
+
url: myapp.com/api/count
|
|
243
|
+
headers:
|
|
244
|
+
X-Api-Key:
|
|
245
|
+
_secret: API_KEY
|
|
246
|
+
# ...
|
|
247
|
+
requests:
|
|
248
|
+
- id: get_count
|
|
249
|
+
type: AxiosHttp
|
|
250
|
+
connectionId: get_count
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Setting properties on only the request, and using a generic connection
|
|
254
|
+
|
|
255
|
+
```yaml
|
|
256
|
+
connections:
|
|
257
|
+
- id: axios
|
|
258
|
+
type: AxiosHttp
|
|
259
|
+
# ...
|
|
260
|
+
requests:
|
|
261
|
+
- id: get_api_1
|
|
262
|
+
type: AxiosHttp
|
|
263
|
+
connectionId: axios
|
|
264
|
+
properties:
|
|
265
|
+
url: app1.com/api/things
|
|
266
|
+
- id: post_to_api_2
|
|
267
|
+
type: AxiosHttp
|
|
268
|
+
connectionId: axios
|
|
269
|
+
payload:
|
|
270
|
+
data:
|
|
271
|
+
_state: true
|
|
272
|
+
properties:
|
|
273
|
+
url: api.otherapp.org/other/thing
|
|
274
|
+
method: post
|
|
275
|
+
data:
|
|
276
|
+
_payload: data
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
</EXAMPLES>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/connection-axios-http",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20251010122007",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"dist/*"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@lowdefy/helpers": "0.0.0-experimental-
|
|
38
|
+
"@lowdefy/helpers": "0.0.0-experimental-20251010122007",
|
|
39
39
|
"axios": "1.8.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@lowdefy/ajv": "0.0.0-experimental-
|
|
42
|
+
"@lowdefy/ajv": "0.0.0-experimental-20251010122007",
|
|
43
43
|
"@swc/cli": "0.1.63",
|
|
44
44
|
"@swc/core": "1.3.99",
|
|
45
45
|
"@swc/jest": "0.2.29",
|