File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,24 @@ apiInstance.getMonitor(params).then((data: v1.Monitor) => {
39
39
40
40
```
41
41
42
+ ### Authentication
43
+
44
+ By default the library will use the ` DD_API_KEY ` and ` DD_APP_KEY ` environment variables to authenticate against the Datadog API.
45
+ To provide your own set of credentials, you need to set the appropriate keys on the configuration:
46
+
47
+ ``` typescript
48
+ import { v1 } from ' @datadog/datadog-api-client' ;
49
+
50
+ const configurationOpts = {
51
+ authMethods: {
52
+ apiKeyAuth: " <API KEY>" ,
53
+ appKeyAuth: " <APPLICATION KEY>"
54
+ },
55
+ };
56
+
57
+ const configuration = v1 .createConfiguration (configurationOpts );
58
+ ```
59
+
42
60
### Unstable Endpoints
43
61
44
62
This client includes access to Datadog API endpoints while they are in an unstable state and may undergo breaking changes. An extra configuration step is required to enable these endpoints:
@@ -122,6 +140,27 @@ apiInstance.listMonitors().then((data: v1.Monitor[]) => {
122
140
}).catch ((error : any ) => console .error (error )).finally (() => clearTimeout (timeout ));
123
141
```
124
142
143
+ ### Pagination
144
+
145
+ Several listing operations have a pagination method to help consume all the items available.
146
+ For example, to retrieve all your incidents:
147
+
148
+ ``` typescript
149
+ import { v2 } from " @datadog/datadog-api-client" ;
150
+
151
+ async function main() {
152
+ const configuration = v2 .createConfiguration ();
153
+ configuration .unstableOperations [" listIncidents" ] = true ;
154
+ const apiInstance = new v2 .IncidentsApi (configuration );
155
+
156
+ for await (const incident of apiInstance .listIncidentsWithPagination ()) {
157
+ console .log (" Got incident " + incident .id );
158
+ }
159
+ }
160
+
161
+ main ();
162
+ ```
163
+
125
164
## Documentation
126
165
127
166
Documentation for API endpoints can be found in in [ Github pages] [ github pages ] .
You can’t perform that action at this time.
0 commit comments