-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Synthetics endpoint to fetch uptimes in API spec (#1792)
* add support for top level indexing * Regenerate client from commit 3b4747f4 of spec repo --------- Co-authored-by: Sherzod Karimov <sherzod.karimov@datadoghq.com> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
82e2cbc
commit 77a185d
Showing
17 changed files
with
730 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...tch-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/frozen.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"2024-10-02T14:22:00.562Z" |
67 changes: 67 additions & 0 deletions
67
...h-uptime-for-multiple-tests-returns-JSON-format-is-wrong-response_342558948/recording.har
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"log": { | ||
"_recordingName": "Synthetics/Fetch uptime for multiple tests returns \"- JSON format is wrong\" response", | ||
"creator": { | ||
"comment": "persister:fs", | ||
"name": "Polly.JS", | ||
"version": "6.0.5" | ||
}, | ||
"entries": [ | ||
{ | ||
"_id": "23da9bb74dd412c237ee8406f9945944", | ||
"_order": 0, | ||
"cache": {}, | ||
"request": { | ||
"bodySize": 39, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"_fromType": "array", | ||
"name": "accept", | ||
"value": "application/json" | ||
}, | ||
{ | ||
"_fromType": "array", | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 570, | ||
"httpVersion": "HTTP/1.1", | ||
"method": "POST", | ||
"postData": { | ||
"mimeType": "application/json", | ||
"params": [], | ||
"text": "{\"from_ts\":0,\"public_ids\":[],\"to_ts\":0}" | ||
}, | ||
"queryString": [], | ||
"url": "https://api.datadoghq.com/api/v1/synthetics/tests/uptimes" | ||
}, | ||
"response": { | ||
"bodySize": 79, | ||
"content": { | ||
"mimeType": "application/json", | ||
"size": 79, | ||
"text": "{\"errors\":[\"Minimum number of elements in parameter 'public_ids' should be 1\"]}" | ||
}, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 664, | ||
"httpVersion": "HTTP/1.1", | ||
"redirectURL": "", | ||
"status": 400, | ||
"statusText": "Bad Request" | ||
}, | ||
"startedDateTime": "2024-10-02T14:22:00.573Z", | ||
"time": 81 | ||
} | ||
], | ||
"pages": [], | ||
"version": "1.2" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ics_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/frozen.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"2024-09-11T13:09:28.349Z" |
67 changes: 67 additions & 0 deletions
67
...s_2658572017/Fetch-uptime-for-multiple-tests-returns-OK-response_2057501027/recording.har
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"log": { | ||
"_recordingName": "Synthetics/Fetch uptime for multiple tests returns \"OK.\" response", | ||
"creator": { | ||
"comment": "persister:fs", | ||
"name": "Polly.JS", | ||
"version": "6.0.5" | ||
}, | ||
"entries": [ | ||
{ | ||
"_id": "5bb349ef4e2317c9387395651078521d", | ||
"_order": 0, | ||
"cache": {}, | ||
"request": { | ||
"bodySize": 70, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"_fromType": "array", | ||
"name": "accept", | ||
"value": "application/json" | ||
}, | ||
{ | ||
"_fromType": "array", | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 570, | ||
"httpVersion": "HTTP/1.1", | ||
"method": "POST", | ||
"postData": { | ||
"mimeType": "application/json", | ||
"params": [], | ||
"text": "{\"from_ts\":1726041488,\"public_ids\":[\"p8m-9gw-nte\"],\"to_ts\":1726055954}" | ||
}, | ||
"queryString": [], | ||
"url": "https://api.datadoghq.com/api/v1/synthetics/tests/uptimes" | ||
}, | ||
"response": { | ||
"bodySize": 314, | ||
"content": { | ||
"mimeType": "application/json", | ||
"size": 314, | ||
"text": "[{\"from_ts\":1726041488,\"to_ts\":1726055954,\"overall\":{\"name\":\"[Synthetics] Synthetics test\",\"preview\":false,\"monitor_type\":\"synthetics alert\",\"monitor_modified\":1726060063,\"errors\":null,\"span_precision\":0,\"history\":[[1726004543,0],[1726053503,1]],\"uptime\":83.05682373046875},\"public_id\":\"p8m-9gw-nte\",\"groups\":[]}]\n" | ||
}, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 665, | ||
"httpVersion": "HTTP/1.1", | ||
"redirectURL": "", | ||
"status": 200, | ||
"statusText": "OK" | ||
}, | ||
"startedDateTime": "2024-09-11T13:09:28.358Z", | ||
"time": 508 | ||
} | ||
], | ||
"pages": [], | ||
"version": "1.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Fetch uptime for multiple tests returns "OK." response | ||
*/ | ||
|
||
import { client, v1 } from "@datadog/datadog-api-client"; | ||
|
||
const configuration = client.createConfiguration(); | ||
const apiInstance = new v1.SyntheticsApi(configuration); | ||
|
||
const params: v1.SyntheticsApiFetchUptimesRequest = { | ||
body: { | ||
fromTs: 1726041488, | ||
publicIds: ["p8m-9gw-nte"], | ||
toTs: 1726055954, | ||
}, | ||
}; | ||
|
||
apiInstance | ||
.fetchUptimes(params) | ||
.then((data: v1.SyntheticsTestUptime[]) => { | ||
console.log( | ||
"API called successfully. Returned data: " + JSON.stringify(data) | ||
); | ||
}) | ||
.catch((error: any) => console.error(error)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.