Skip to content

Commit 0909a49

Browse files
authored
add multihttp spec (#177)
* add multihttp spec * remove postData from multihttp spec
1 parent 58afdc8 commit 0909a49

File tree

1 file changed

+89
-12
lines changed

1 file changed

+89
-12
lines changed

docs/API.md

Lines changed: 89 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Synthetic Monitoring API
2-
========================
1+
# Synthetic Monitoring API
32

43
This document describes the Synthetic Monitoring API. All the entry
54
points return results formatted as JSON objects.
@@ -79,6 +78,7 @@ Authorization required: yes (see description)
7978
Content-type: application/json; charset=utf-8
8079

8180
Body:
81+
8282
```
8383
{
8484
"stackId": 123,
@@ -88,11 +88,13 @@ Body:
8888
```
8989

9090
Header:
91+
9192
```
9293
Authorization: Bearer <grafana publisher token>
9394
```
9495

9596
Response:
97+
9698
```
9799
{
98100
"accessToken": <string>,
@@ -111,7 +113,7 @@ corresponding hosted metric and log instances.
111113

112114
The authentication is different from all the other authenticated entry points
113115
in that the token _is not_ the access token returned by this call, but instead
114-
it's a `grafana.com` API *publisher token*. This token is used to authenticate
116+
it's a `grafana.com` API _publisher token_. This token is used to authenticate
115117
the request and obtain the `grafana.com` organization associated with the new
116118
tenant. It is also saved by the Synthetic Monitoring backend and passed to the
117119
probes so that they can publish metrics and logs to the specified hosted
@@ -141,6 +143,7 @@ Authorization required: yes
141143
Body: none
142144

143145
Response:
146+
144147
```
145148
{
146149
"msg": <user facing message>,
@@ -161,6 +164,7 @@ Authorization required: yes
161164
Body: none
162165

163166
Response:
167+
164168
```
165169
{
166170
"msg": <user facing message>,
@@ -180,6 +184,7 @@ Authorization required: yes
180184
Body: none
181185

182186
Response:
187+
183188
```
184189
{
185190
"msg": <user facing message>,
@@ -189,7 +194,7 @@ Response:
189194

190195
Description:
191196

192-
A new access token is created for the authenticated tenant. The token
197+
A new access token is created for the authenticated tenant. The token
193198
used for authentication is deleted.
194199

195200
### /api/v1/token/validate
@@ -201,6 +206,7 @@ Authorization required: yes
201206
Body: none
202207

203208
Response:
209+
204210
```
205211
{
206212
"msg": <user facing message>,
@@ -228,6 +234,7 @@ Authorization required: yes
228234
Content-type: application/json; charset=utf-8
229235

230236
Body:
237+
231238
```
232239
{
233240
"target": <string>,
@@ -361,6 +368,59 @@ For TCP, the structure is as follows:
361368
}
362369
```
363370

371+
For MultiHTTP, the structure is as follows:
372+
373+
```
374+
<MultiHttpSettings>: {
375+
"entries": [
376+
{
377+
"variables": [
378+
{
379+
type: <int>,
380+
name: <string>,
381+
expression: <string>,
382+
attribute: <string>,
383+
},
384+
...
385+
],
386+
"checks": [
387+
{
388+
type: <int>,
389+
subject: <int>,
390+
expression: <string>,
391+
condition: <int>,
392+
value: <string>
393+
},
394+
...
395+
],
396+
"request": {
397+
method:("GET"|"POST"|"PUT"|"PATCH"|"DELETE"|"OPTIONS"|"HEAD"),
398+
url: <string>,
399+
body: {
400+
contentType: <string>,
401+
contentEncoding: <string>,
402+
payload: <string>,
403+
}
404+
headers: [
405+
{
406+
name: <string>,
407+
value: <string>,
408+
},
409+
...
410+
]
411+
queryFields: [
412+
{
413+
name: <string>,
414+
value: <string>,
415+
},
416+
]
417+
},
418+
},
419+
...
420+
]
421+
}
422+
```
423+
364424
The following structures are used in multiple fields:
365425

366426
```
@@ -387,6 +447,7 @@ The following structures are used in multiple fields:
387447
```
388448

389449
Response:
450+
390451
```
391452
{
392453
"id": <int>,
@@ -433,9 +494,9 @@ The `ipVersion` value specifies whether the corresponding check will be
433494
performed using IPv4 or IPv6. The "Any" value indicates that IPv6 should
434495
be used, falling back to IPv4 if that's not available.
435496

436-
The `basicMetricsOnly` value specifies which set of metrics probes will collect. This is set to `true` by default in the UI which results in less active series or can be set to `false` for the advanced set. We maintain a [full list of metrics](https://github.com/grafana/synthetic-monitoring-agent/tree/main/internal/scraper/testdata) collected for each.
497+
The `basicMetricsOnly` value specifies which set of metrics probes will collect. This is set to `true` by default in the UI which results in less active series or can be set to `false` for the advanced set. We maintain a [full list of metrics](https://github.com/grafana/synthetic-monitoring-agent/tree/main/internal/scraper/testdata) collected for each.
437498

438-
The `alertSensitivity` value defaults to `none` if there are no alerts or can be set to `low`, `medium`, or `high` to correspond to the check [alert levels](https://grafana.com/docs/grafana-cloud/synthetic-monitoring/synthetic-monitoring-alerting/).
499+
The `alertSensitivity` value defaults to `none` if there are no alerts or can be set to `low`, `medium`, or `high` to correspond to the check [alert levels](https://grafana.com/docs/grafana-cloud/synthetic-monitoring/synthetic-monitoring-alerting/).
439500

440501
The maximum number of labels that can be specified per check is 5. These
441502
are applied, along with the probe-specific labels, to the outgoing
@@ -470,6 +531,7 @@ Authorization required: yes
470531
Content-type: application/json; charset=utf-8
471532

472533
Body:
534+
473535
```
474536
{
475537
"id": <int>,
@@ -480,7 +542,7 @@ Body:
480542
"timeout": <int>,
481543
"enabled": <boolean>,
482544
"alertSensitivity": <string>,
483-
"basicMetricsOnly": <boolean>,
545+
"basicMetricsOnly": <boolean>,
484546
"probes": [
485547
<int>,
486548
...
@@ -497,6 +559,7 @@ Body:
497559
```
498560

499561
Response:
562+
500563
```
501564
{
502565
"id": <int>,
@@ -507,7 +570,7 @@ Response:
507570
"timeout": <int>,
508571
"enabled": <boolean>,
509572
"alertSensitivity": <string>,
510-
"basicMetricsOnly": <boolean>,
573+
"basicMetricsOnly": <boolean>,
511574
"probes": [
512575
<int>,
513576
...
@@ -538,6 +601,7 @@ Method: DELETE
538601
Authorization required: yes
539602

540603
Response:
604+
541605
```
542606
{
543607
"msg": "check deleted",
@@ -556,6 +620,7 @@ Method: GET
556620
Authorization required: yes
557621

558622
Response:
623+
559624
```
560625
[
561626
<check>,
@@ -574,6 +639,7 @@ Method: GET
574639
Authorization required: yes
575640

576641
Response:
642+
577643
```
578644
{
579645
"id": <int>,
@@ -584,7 +650,7 @@ Response:
584650
"timeout": <int>,
585651
"enabled": <boolean>,
586652
"alertSensitivity": <string>,
587-
"basicMetricsOnly": <boolean>,
653+
"basicMetricsOnly": <boolean>,
588654
"probes": [
589655
<int>,
590656
...
@@ -604,7 +670,7 @@ Response:
604670

605671
Description:
606672

607-
Get a specific check, that matches the `id` supplied in the URL parameter.
673+
Get a specific check, that matches the `id` supplied in the URL parameter.
608674

609675
### /api/v1/check/query?job=:job:&target=:target:
610676

@@ -613,6 +679,7 @@ Method: GET
613679
Authorization required: yes
614680

615681
Response:
682+
616683
```
617684
{
618685
"id": <int>,
@@ -623,7 +690,7 @@ Response:
623690
"timeout": <int>,
624691
"enabled": <boolean>,
625692
"alertSensitivity": <string>,
626-
"basicMetricsOnly": <boolean>,
693+
"basicMetricsOnly": <boolean>,
627694
"probes": [
628695
<int>,
629696
...
@@ -643,7 +710,7 @@ Response:
643710

644711
Description:
645712

646-
Get a specific check, that matches the `job` and `target` supplied in the query parameters.
713+
Get a specific check, that matches the `job` and `target` supplied in the query parameters.
647714

648715
## Probes
649716

@@ -656,6 +723,7 @@ Authorization required: yes
656723
Content-type: application/json; charset=utf-8
657724

658725
Body:
726+
659727
```
660728
{
661729
"name": <string>,
@@ -673,6 +741,7 @@ Body:
673741
```
674742

675743
Response:
744+
676745
```
677746
{
678747
"probe": {
@@ -720,6 +789,7 @@ Authorization required: yes
720789
Content-type: application/json; charset=utf-8
721790

722791
Body:
792+
723793
```
724794
{
725795
"id": <int>,
@@ -739,6 +809,7 @@ Body:
739809
```
740810

741811
Response:
812+
742813
```
743814
{
744815
"probe": {
@@ -780,6 +851,7 @@ Method: GET
780851
Authorization required: yes
781852

782853
Response:
854+
783855
```
784856
[
785857
{
@@ -815,6 +887,7 @@ Method: DELETE
815887
Authorization required: yes
816888

817889
Response:
890+
818891
```
819892
{
820893
"msg": "probe deleted",
@@ -835,6 +908,7 @@ Method: GET
835908
Authorization required: yes
836909

837910
Response:
911+
838912
```
839913
<tenant>
840914
```
@@ -853,6 +927,7 @@ Authorization required: yes
853927
Content-type: application/json; charset=utf-8
854928

855929
Body:
930+
856931
```
857932
{
858933
"id": <int>,
@@ -876,6 +951,7 @@ Body:
876951
```
877952

878953
Response:
954+
879955
```
880956
{
881957
"msg": "tenant updated",
@@ -910,6 +986,7 @@ Method: DELETE
910986
Authorization required: yes
911987

912988
Response:
989+
913990
```
914991
{
915992
"msg": "tenant deleted",

0 commit comments

Comments
 (0)