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
The `url` API allows you to retrieve information from an HTTP endpoint.
3
+
The `url` API allows you to retrieve information from an HTTP endpoint.
4
4
5
-
*[Basic usage](#Basicusage)
6
-
*[Use POST/PUT methods with a body](#UsePOSTPUTmethodswithabody)
7
-
*[Configure your HTTPS connections](#ConfigureyourHTTPSconnections)
8
-
*[Specify a common base URL](#SpecifyacommonbaseURL)
9
-
*[URL with cache for later processing](#URLwithcacheforlaterprocessing)
10
-
*[Include response headers on sample](#ReturnResponseHeaders)
5
+
-[Basic usage](#Basicusage)
6
+
-[Use POST/PUT methods with a body](#UsePOSTPUTmethodswithabody)
7
+
-[Configure your HTTPS connections](#ConfigureyourHTTPSconnections)
8
+
-[Specify a common base URL](#SpecifyacommonbaseURL)
9
+
-[URL with cache for later processing](#URLwithcacheforlaterprocessing)
10
+
-[Include response headers on sample](#ReturnResponseHeaders)
11
11
12
-
## <aname='Basicusage'></a>Basic usage
12
+
## <aname='Basicusage'></a>Basic usage
13
13
14
-
```yaml
14
+
```yaml
15
15
name: example
16
16
apis:
17
17
- event_type: ExampleSample
@@ -22,29 +22,31 @@ apis:
22
22
23
23
The above Flex configuration retrieves a JSON file containing a set of metrics from the provided URL. Note that the `url` key can be followed by a `headers` section, which allows specifying HTTP headers.
24
24
25
-
## <a name='UsePOSTPUTmethodswithabody'></a>Use POST/PUT methods with a body
25
+
## <a name='UsePOSTPUTmethodswithabody'></a>Use POST/PUT methods with a body
26
26
27
27
To specify a `POST` or `PUT` request with a body, use the `method` and `payload` properties.
28
28
29
29
```yaml
30
-
name: httpPostExample
31
-
apis:
30
+
name: httpPostExample
31
+
apis:
32
32
- name: httpPost
33
33
url: https://jsonplaceholder.typicode.com/posts
34
34
method: POST
35
-
payload: >
35
+
payload: >
36
36
{"title": "foo","body": "bar","userId": 1}
37
37
```
38
38
39
-
## <a name='ConfigureyourHTTPSconnections'></a>Configure your HTTPS connections
39
+
## <a name='ConfigureyourHTTPSconnections'></a>Configure your HTTPS connections
40
40
41
41
When using TLS endpoints with self-signed certificates, define a `tls_config` section with any of the following items:
42
42
43
-
| Name | Type | Default | Description |
44
-
|---:|:---:|:---:|---|
45
-
| `enable` | bool | `false` | Set to `true` to enable custom TLS configuration. Requires `ca` to be defined if enabled. |
46
-
| `insecure_skip_verify` | bool | `false` | Set to `true` to skip the verification of TLS certificates. |
47
-
| `ca` | string | _Empty_ | The Certificate Authority PEM certificate, in case your HTTPS endpoint has self-signed certificates. |
| `enable` | bool | `false` | Set to `true` to enable custom TLS configuration. Requires `ca` to be defined if enabled. |
46
+
| `insecure_skip_verify` | bool | `false` | Set to `true` to skip the verification of TLS certificates. |
47
+
| `ca` | string | _Empty_ | The Certificate Authority PEM certificate, in case your HTTPS endpoint has self-signed certificates. |
48
+
| `cert` | string | _Empty_ | PEM encoded certificate (must be used with `key`), in case your HTTPS endpoint has self-signed certificates. |
49
+
| `key` | string | _Empty_ | PEM encoded key (must be used with `cert`), in case your HTTPS endpoint has self-signed certificates. |
48
50
49
51
### TLS configuration example:
50
52
@@ -60,18 +62,18 @@ apis:
60
62
ca: /etc/bundles/my-ca-cert.pem
61
63
```
62
64
63
-
## <a name='SpecifyacommonbaseURL'></a>Specify a common base URL
65
+
## <a name='SpecifyacommonbaseURL'></a>Specify a common base URL
64
66
65
67
When you have to query several different URLs, specifying a `base_url` under `global` can be quite helpful, as it allows you to provide URL path segment in `url` fields instead of full URLs.
66
68
67
-
### Base URL example
69
+
### Base URL example
68
70
69
71
```yaml
70
72
name: consulFlex
71
73
global:
72
-
base_url: http://consul-host/v1/
73
-
headers:
74
-
X-Consul-Token: my-root-consul-token
74
+
base_url: http://consul-host/v1/
75
+
headers:
76
+
X-Consul-Token: my-root-consul-token
75
77
apis:
76
78
- event_type: ConsulHealthSample
77
79
url: health/service/consul
@@ -81,7 +83,7 @@ apis:
81
83
url: agent/members
82
84
```
83
85
84
-
## <a name='URLwithcacheforlaterprocessing'></a>URL with cache for later processing
86
+
## <a name='URLwithcacheforlaterprocessing'></a>URL with cache for later processing
85
87
86
88
URL invocations are cached to avoid having to query them repeatedly. Use `cache` under `command` to read cached data.
0 commit comments