All URIs are relative to https://app.launchdarkly.com
Method | HTTP request | Description |
---|---|---|
deleteMetric | DELETE /api/v2/metrics/{projectKey}/{metricKey} | Delete metric |
getMetric | GET /api/v2/metrics/{projectKey}/{metricKey} | Get metric |
getMetrics | GET /api/v2/metrics/{projectKey} | List metrics |
patchMetric | PATCH /api/v2/metrics/{projectKey}/{metricKey} | Update metric |
postMetric | POST /api/v2/metrics/{projectKey} | Create metric |
deleteMetric(projectKey, metricKey)
Delete metric
Delete a metric by key.
// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.MetricsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://app.launchdarkly.com");
// Configure API key authorization: ApiKey
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.setApiKeyPrefix("Token");
MetricsApi apiInstance = new MetricsApi(defaultClient);
String projectKey = "projectKey_example"; // String | The project key
String metricKey = "metricKey_example"; // String | The metric key
try {
apiInstance.deleteMetric(projectKey, metricKey);
} catch (ApiException e) {
System.err.println("Exception when calling MetricsApi#deleteMetric");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
metricKey | String | The metric key |
null (empty response body)
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | Action succeeded | - |
401 | Invalid access token | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
429 | Rate limited | - |
MetricRep getMetric(projectKey, metricKey, expand, versionId)
Get metric
Get information for a single metric from the specific project. ### Expanding the metric response LaunchDarkly supports four fields for expanding the "Get metric" response. By default, these fields are not included in the response. To expand the response, append the `expand` query parameter and add a comma-separated list with any of the following fields: - `experiments` includes all experiments from the specific project that use the metric - `experimentCount` includes the number of experiments from the specific project that use the metric - `metricGroups` includes all metric groups from the specific project that use the metric - `metricGroupCount` includes the number of metric groups from the specific project that use the metric For example, `expand=experiments` includes the `experiments` field in the response.
// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.MetricsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://app.launchdarkly.com");
// Configure API key authorization: ApiKey
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.setApiKeyPrefix("Token");
MetricsApi apiInstance = new MetricsApi(defaultClient);
String projectKey = "projectKey_example"; // String | The project key
String metricKey = "metricKey_example"; // String | The metric key
String expand = "expand_example"; // String | A comma-separated list of properties that can reveal additional information in the response.
String versionId = "versionId_example"; // String | The specific version ID of the metric
try {
MetricRep result = apiInstance.getMetric(projectKey, metricKey, expand, versionId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MetricsApi#getMetric");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
metricKey | String | The metric key | |
expand | String | A comma-separated list of properties that can reveal additional information in the response. | [optional] |
versionId | String | The specific version ID of the metric | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Metric response | - |
401 | Invalid access token | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
429 | Rate limited | - |
MetricCollectionRep getMetrics(projectKey, expand, limit, offset, sort, filter)
List metrics
Get a list of all metrics for the specified project. ### Filtering metrics The `filter` parameter supports the following operators: `contains`. #### Supported fields and operators You can only filter certain fields in metrics when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for metrics, the `filter` parameter supports the following fields and operators: |<div style="width:120px">Field</div> |Description |Supported operators | |---|---|---| | `tags` | The metric tags. | `contains` | For example, the filter `?filter=tags contains ["tag1", "tag2", "tag3"]` matches metrics that have all three tags. The documented values for `filter` query parameters are prior to URL encoding. For example, the `[` in `?filter=tags contains ["tag1", "tag2", "tag3"]` must be encoded to `%5B`. ### Expanding the metric list response LaunchDarkly supports expanding the "List metrics" response. By default, the expandable field is not included in the response. To expand the response, append the `expand` query parameter and add the following supported field: - `experimentCount` includes the number of experiments from the specific project that use the metric For example, `expand=experimentCount` includes the `experimentCount` field for each metric in the response.
// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.MetricsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://app.launchdarkly.com");
// Configure API key authorization: ApiKey
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.setApiKeyPrefix("Token");
MetricsApi apiInstance = new MetricsApi(defaultClient);
String projectKey = "projectKey_example"; // String | The project key
String expand = "expand_example"; // String | A comma-separated list of properties that can reveal additional information in the response.
Long limit = 56L; // Long | The number of metrics to return in the response. Defaults to 20. Maximum limit is 50.
Long offset = 56L; // Long | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and returns the next `limit` items.
String sort = "sort_example"; // String | A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `createdAt` or `name`.
String filter = "filter_example"; // String | A comma-separated list of filters. This endpoint only accepts filtering by `tags`. To learn more about the filter syntax, read the 'Filtering metrics' section above.
try {
MetricCollectionRep result = apiInstance.getMetrics(projectKey, expand, limit, offset, sort, filter);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MetricsApi#getMetrics");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
expand | String | A comma-separated list of properties that can reveal additional information in the response. | [optional] |
limit | Long | The number of metrics to return in the response. Defaults to 20. Maximum limit is 50. | [optional] |
offset | Long | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and returns the next `limit` items. | [optional] |
sort | String | A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `createdAt` or `name`. | [optional] |
filter | String | A comma-separated list of filters. This endpoint only accepts filtering by `tags`. To learn more about the filter syntax, read the 'Filtering metrics' section above. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Metrics collection response | - |
401 | Invalid access token | - |
404 | Invalid resource identifier | - |
MetricRep patchMetric(projectKey, metricKey, patchOperation)
Update metric
Patch a metric by key. Updating a metric uses a JSON patch representation of the desired changes. To learn more, read Updates.
// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.MetricsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://app.launchdarkly.com");
// Configure API key authorization: ApiKey
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.setApiKeyPrefix("Token");
MetricsApi apiInstance = new MetricsApi(defaultClient);
String projectKey = "projectKey_example"; // String | The project key
String metricKey = "metricKey_example"; // String | The metric key
List<PatchOperation> patchOperation = Arrays.asList(); // List<PatchOperation> |
try {
MetricRep result = apiInstance.patchMetric(projectKey, metricKey, patchOperation);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MetricsApi#patchMetric");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
metricKey | String | The metric key | |
patchOperation | List<PatchOperation> |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Metric response | - |
400 | Invalid request | - |
401 | Invalid access token | - |
404 | Invalid resource identifier | - |
409 | Status conflict | - |
429 | Rate limited | - |
MetricRep postMetric(projectKey, metricPost)
Create metric
Create a new metric in the specified project. The expected `POST` body differs depending on the specified `kind` property.
// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.MetricsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://app.launchdarkly.com");
// Configure API key authorization: ApiKey
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.setApiKeyPrefix("Token");
MetricsApi apiInstance = new MetricsApi(defaultClient);
String projectKey = "projectKey_example"; // String | The project key
MetricPost metricPost = new MetricPost(); // MetricPost |
try {
MetricRep result = apiInstance.postMetric(projectKey, metricPost);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MetricsApi#postMetric");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
metricPost | MetricPost |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
201 | Metric response | - |
400 | Invalid request | - |
401 | Invalid access token | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
409 | Status conflict | - |
429 | Rate limited | - |