Skip to content

Latest commit

 

History

History
238 lines (186 loc) · 10.5 KB

LayersApi.md

File metadata and controls

238 lines (186 loc) · 10.5 KB

LayersApi

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

createLayer

LayerRep createLayer(projectKey, layerPost)

Create layer

Create a layer. Experiments running in the same layer are granted mutually-exclusive traffic.

Example

// 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();
    }
  }
}

Parameters

Name Type Description Notes
projectKey String The project key
layerPost LayerPost

Return type

LayerRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Layer response -
400 Invalid request -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -

getLayers

LayerCollectionRep getLayers(projectKey, filter)

Get layers

Get a collection of all layers for a project

Example

// 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();
    }
  }
}

Parameters

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]

Return type

LayerCollectionRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Layer Collection response -
400 Invalid request -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -

updateLayer

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 { &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateName&quot;, &quot;name&quot;: &quot;New name&quot; }] } ``` #### updateDescription Updates the layer description. ##### Parameters - `description`: The new description. Here's an example: ```json { &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateDescription&quot;, &quot;description&quot;: &quot;New description&quot; }] } ``` #### 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 { &quot;environmentKey&quot;: &quot;production&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateExperimentReservation&quot;, &quot;experimentKey&quot;: &quot;exp-key&quot;, &quot;reservationPercent&quot;: 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 { &quot;environmentKey&quot;: &quot;production&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;removeExperiment&quot;, &quot;experimentKey&quot;: &quot;exp-key&quot; }] } ``` </details>

Example

// 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();
    }
  }
}

Parameters

Name Type Description Notes
projectKey String The project key
layerKey String The layer key
layerPatchInput LayerPatchInput

Return type

LayerRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Layer response -
400 Invalid request -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -