All URIs are relative to https://app.launchdarkly.com
Method | HTTP request | Description |
---|---|---|
createLayer | POST /api/v2/projects/{projectKey}/layers | Create layer |
getLayers | GET /api/v2/projects/{projectKey}/layers | Get layers |
updateLayer | PATCH /api/v2/projects/{projectKey}/layers/{layerKey} | Update layer |
LayerRep createLayer(projectKey, layerPost)
Create layer
Create a layer. Experiments running in the same layer are granted mutually-exclusive traffic.
// 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.LayersApi;
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");
LayersApi apiInstance = new LayersApi(defaultClient);
String projectKey = "projectKey_example"; // String | The project key
LayerPost layerPost = new LayerPost(); // LayerPost |
try {
LayerRep result = apiInstance.createLayer(projectKey, layerPost);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LayersApi#createLayer");
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 | |
layerPost | LayerPost |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
201 | Layer response | - |
400 | Invalid request | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
429 | Rate limited | - |
LayerCollectionRep getLayers(projectKey, filter)
Get layers
Get a collection of all layers for a project
// 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.LayersApi;
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");
LayersApi apiInstance = new LayersApi(defaultClient);
String projectKey = "projectKey_example"; // String | The project key
String filter = "filter_example"; // String | A comma-separated list of filters. This endpoint only accepts filtering by `experimentKey`. The filter returns layers which include that experiment for the selected environment(s). For example: `filter=reservations.experimentKey contains expKey`.
try {
LayerCollectionRep result = apiInstance.getLayers(projectKey, filter);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LayersApi#getLayers");
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 | |
filter | String | A comma-separated list of filters. This endpoint only accepts filtering by `experimentKey`. The filter returns layers which include that experiment for the selected environment(s). For example: `filter=reservations.experimentKey contains expKey`. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Layer Collection response | - |
400 | Invalid request | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
429 | Rate limited | - |
LayerRep updateLayer(projectKey, layerKey, layerPatchInput)
Update layer
Update a layer by adding, changing, or removing traffic reservations for experiments, or by changing layer name or description. Updating a layer uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read Updates using semantic patch. ### Instructions Semantic patch requests support the following `kind` instructions for updating layers. <details> <summary>Click to expand instructions for <strong>updating layers</strong></summary> #### updateName Updates the layer name. ##### Parameters - `name`: The new layer name. Here's an example: ```json { "instructions": [{ "kind": "updateName", "name": "New name" }] } ``` #### updateDescription Updates the layer description. ##### Parameters - `description`: The new description. Here's an example: ```json { "instructions": [{ "kind": "updateDescription", "description": "New description" }] } ``` #### updateExperimentReservation Adds or updates a traffic reservation for an experiment in a layer. ##### Parameters - `experimentKey`: The key of the experiment whose reservation you are adding to or updating in the layer. - `reservationPercent`: The amount of traffic in the layer to reserve. Must be an integer. Zero is allowed until iteration start. Here's an example: ```json { "environmentKey": "production", "instructions": [{ "kind": "updateExperimentReservation", "experimentKey": "exp-key", "reservationPercent": 10 }] } ``` #### removeExperiment Removes a traffic reservation for an experiment from a layer. ##### Parameters - `experimentKey`: The key of the experiment whose reservation you want to remove from the layer. Here's an example: ```json { "environmentKey": "production", "instructions": [{ "kind": "removeExperiment", "experimentKey": "exp-key" }] } ``` </details>
// 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.LayersApi;
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");
LayersApi apiInstance = new LayersApi(defaultClient);
String projectKey = "projectKey_example"; // String | The project key
String layerKey = "layerKey_example"; // String | The layer key
LayerPatchInput layerPatchInput = new LayerPatchInput(); // LayerPatchInput |
try {
LayerRep result = apiInstance.updateLayer(projectKey, layerKey, layerPatchInput);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LayersApi#updateLayer");
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 | |
layerKey | String | The layer key | |
layerPatchInput | LayerPatchInput |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Layer response | - |
400 | Invalid request | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
429 | Rate limited | - |