-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathDeleteRows.java
More file actions
34 lines (30 loc) · 1.31 KB
/
DeleteRows.java
File metadata and controls
34 lines (30 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Delete rows returns "Rows deleted successfully" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ReferenceTablesApi;
import com.datadog.api.client.v2.model.BatchDeleteRowsRequestArray;
import com.datadog.api.client.v2.model.BatchDeleteRowsRequestData;
import com.datadog.api.client.v2.model.TableRowResourceDataType;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
ReferenceTablesApi apiInstance = new ReferenceTablesApi(defaultClient);
BatchDeleteRowsRequestArray body =
new BatchDeleteRowsRequestArray()
.data(
Collections.singletonList(
new BatchDeleteRowsRequestData()
.id("primary_key_value")
.type(TableRowResourceDataType.ROW)));
try {
apiInstance.deleteRows("id", body);
} catch (ApiException e) {
System.err.println("Exception when calling ReferenceTablesApi#deleteRows");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}