This repository contains a client library for LaunchDarkly's REST API. This client was automatically generated from our OpenAPI specification.

This REST API is for custom integrations, data export, or automating your feature flag workflows. DO NOT use this client library to include feature flags in your web or mobile application. To integrate feature flags with your application, please see the SDK documentation

launchdarkly_api

LaunchDarklyApi - the Ruby gem for the LaunchDarkly REST API

Build custom integrations with the LaunchDarkly REST API

This SDK is automatically generated by the Swagger Codegen project:

  • API version: 5.0.2
  • Package version: 5.0.2
  • Build package: io.swagger.codegen.languages.RubyClientCodegen For more information, please visit https://support.launchdarkly.com

Installation

Build a gem

To build the Ruby code into a gem:

gem build launchdarkly_api.gemspec

Then either install the gem locally:

gem install ./launchdarkly_api-5.0.2.gem

(for development, run gem install --dev ./launchdarkly_api-5.0.2.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'launchdarkly_api', '~> 5.0.2'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'launchdarkly_api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and see the sample code below.

Documentation for API Endpoints

All URIs are relative to https://app.launchdarkly.com/api/v2

Class Method HTTP request Description
LaunchDarklyApi::AccessTokensApi delete_token DELETE /tokens/tokenId Delete an access token by ID.
LaunchDarklyApi::AccessTokensApi get_token GET /tokens/tokenId Get a single access token by ID.
LaunchDarklyApi::AccessTokensApi get_tokens GET /tokens Returns a list of tokens in the account.
LaunchDarklyApi::AccessTokensApi patch_token PATCH /tokens/tokenId Modify an access token by ID.
LaunchDarklyApi::AccessTokensApi post_token POST /tokens Create a new token.
LaunchDarklyApi::AccessTokensApi reset_token POST /tokens/tokenId/reset Reset an access token's secret key with an optional expiry time for the old key.
LaunchDarklyApi::AuditLogApi get_audit_log_entries GET /auditlog Get a list of all audit log entries. The query parameters allow you to restrict the returned results by date ranges, resource specifiers, or a full-text search query.
LaunchDarklyApi::AuditLogApi get_audit_log_entry GET /auditlog/resourceId Use this endpoint to fetch a single audit log entry by its resouce ID.
LaunchDarklyApi::CustomRolesApi delete_custom_role DELETE /roles/customRoleKey Delete a custom role by key.
LaunchDarklyApi::CustomRolesApi get_custom_role GET /roles/customRoleKey Get one custom role by key.
LaunchDarklyApi::CustomRolesApi get_custom_roles GET /roles Return a complete list of custom roles.
LaunchDarklyApi::CustomRolesApi patch_custom_role PATCH /roles/customRoleKey Modify a custom role by key.
LaunchDarklyApi::CustomRolesApi post_custom_role POST /roles Create a new custom role.
LaunchDarklyApi::CustomerMetricsApi get_evaluations GET /usage/evaluations/envId/flagKey Get events usage by event id and the feature flag key.
LaunchDarklyApi::CustomerMetricsApi get_event GET /usage/events/type Get events usage by event type.
LaunchDarklyApi::CustomerMetricsApi get_events GET /usage/events Get events usage endpoints.
LaunchDarklyApi::CustomerMetricsApi get_mau GET /usage/mau Get monthly active user data.
LaunchDarklyApi::CustomerMetricsApi get_mau_by_category GET /usage/mau/bycategory Get monthly active user data by category.
LaunchDarklyApi::CustomerMetricsApi get_stream GET /usage/streams/source Get a stream endpoint and return timeseries data.
LaunchDarklyApi::CustomerMetricsApi get_stream_by_sdk GET /usage/streams/source/bysdkversion Get a stream timeseries data by source show sdk version metadata.
LaunchDarklyApi::CustomerMetricsApi get_stream_sdk_version GET /usage/streams/source/sdkversions Get a stream timeseries data by source and show all sdk version associated.
LaunchDarklyApi::CustomerMetricsApi get_streams GET /usage/streams Returns a list of all streams.
LaunchDarklyApi::CustomerMetricsApi get_usage GET /usage Returns of the usage endpoints available.
LaunchDarklyApi::DataExportDestinationsApi delete_destination DELETE /destinations/projectKey/environmentKey/destinationId Get a single data export destination by ID
LaunchDarklyApi::DataExportDestinationsApi get_destination GET /destinations/projectKey/environmentKey/destinationId Get a single data export destination by ID
LaunchDarklyApi::DataExportDestinationsApi get_destinations GET /destinations Returns a list of all data export destinations.
LaunchDarklyApi::DataExportDestinationsApi patch_destination PATCH /destinations/projectKey/environmentKey/destinationId Perform a partial update to a data export destination.
LaunchDarklyApi::DataExportDestinationsApi post_destination POST /destinations/projectKey/environmentKey Create a new data export destination
LaunchDarklyApi::EnvironmentsApi delete_environment DELETE /projects/projectKey/environments/environmentKey Delete an environment in a specific project.
LaunchDarklyApi::EnvironmentsApi get_environment GET /projects/projectKey/environments/environmentKey Get an environment given a project and key.
LaunchDarklyApi::EnvironmentsApi patch_environment PATCH /projects/projectKey/environments/environmentKey Modify an environment by ID.
LaunchDarklyApi::EnvironmentsApi post_environment POST /projects/projectKey/environments Create a new environment in a specified project with a given name, key, and swatch color.
LaunchDarklyApi::EnvironmentsApi reset_environment_mobile_key POST /projects/projectKey/environments/environmentKey/mobileKey Reset an environment's mobile key. The optional expiry for the old key is deprecated for this endpoint, so the old key will always expire immediately.
LaunchDarklyApi::EnvironmentsApi reset_environment_sdk_key POST /projects/projectKey/environments/environmentKey/apiKey Reset an environment's SDK key with an optional expiry time for the old key.
LaunchDarklyApi::FeatureFlagsApi copy_feature_flag POST /flags/projectKey/featureFlagKey/copy Copies the feature flag configuration from one environment to the same feature flag in another environment.
LaunchDarklyApi::FeatureFlagsApi delete_approval_request DELETE /projects/projectKey/flags/featureFlagKey/environments/environmentKey/approval-requests/approvalRequestId Delete an approval request for a feature flag config
LaunchDarklyApi::FeatureFlagsApi delete_feature_flag DELETE /flags/projectKey/featureFlagKey Delete a feature flag in all environments. Be careful-- only delete feature flags that are no longer being used by your application.
LaunchDarklyApi::FeatureFlagsApi delete_flag_config_scheduled_changes DELETE /projects/projectKey/flags/featureFlagKey/environments/environmentKey/scheduled-changes/scheduledChangeId Delete a scheduled change on a feature flag in an environment.
LaunchDarklyApi::FeatureFlagsApi get_approval_request GET /projects/projectKey/flags/featureFlagKey/environments/environmentKey/approval-requests/approvalRequestId Get a single approval request for a feature flag config
LaunchDarklyApi::FeatureFlagsApi get_approval_requests GET /projects/projectKey/flags/featureFlagKey/environments/environmentKey/approval-requests Get all approval requests for a feature flag config
LaunchDarklyApi::FeatureFlagsApi get_expiring_user_targets GET /flags/projectKey/featureFlagKey/expiring-user-targets/environmentKey Get expiring user targets for feature flag
LaunchDarklyApi::FeatureFlagsApi get_feature_flag GET /flags/projectKey/featureFlagKey Get a single feature flag by key.
LaunchDarklyApi::FeatureFlagsApi get_feature_flag_status GET /flag-statuses/projectKey/environmentKey/featureFlagKey Get the status for a particular feature flag.
LaunchDarklyApi::FeatureFlagsApi get_feature_flag_status_across_environments GET /flag-status/projectKey/featureFlagKey Get the status for a particular feature flag across environments
LaunchDarklyApi::FeatureFlagsApi get_feature_flag_statuses GET /flag-statuses/projectKey/environmentKey Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as the state of the flag.
LaunchDarklyApi::FeatureFlagsApi get_feature_flags GET /flags/projectKey Get a list of all features in the given project.
LaunchDarklyApi::FeatureFlagsApi get_flag_config_scheduled_change GET /projects/projectKey/flags/featureFlagKey/environments/environmentKey/scheduled-changes/scheduledChangeId Get a scheduled change on a feature flag by id.
LaunchDarklyApi::FeatureFlagsApi get_flag_config_scheduled_changes GET /projects/projectKey/flags/featureFlagKey/environments/environmentKey/scheduled-changes Get all scheduled workflows for a feature flag by key.
LaunchDarklyApi::FeatureFlagsApi get_flag_config_scheduled_changes_conflicts POST /projects/projectKey/flags/featureFlagKey/environments/environmentKey/scheduled-changes-conflicts Lists conflicts between the given instructions and any existing scheduled changes for the feature flag. The actual HTTP verb should be REPORT, not POST.
LaunchDarklyApi::FeatureFlagsApi patch_expiring_user_targets PATCH /flags/projectKey/featureFlagKey/expiring-user-targets/environmentKey Update, add, or delete expiring user targets on feature flag
LaunchDarklyApi::FeatureFlagsApi patch_feature_flag PATCH /flags/projectKey/featureFlagKey Perform a partial update to a feature.
LaunchDarklyApi::FeatureFlagsApi patch_flag_config_scheduled_change PATCH /projects/projectKey/flags/featureFlagKey/environments/environmentKey/scheduled-changes/scheduledChangeId Updates an existing scheduled-change on a feature flag in an environment.
LaunchDarklyApi::FeatureFlagsApi post_apply_approval_request POST /projects/projectKey/flags/featureFlagKey/environments/environmentKey/approval-requests/approvalRequestId/apply Apply approval request for a feature flag config
LaunchDarklyApi::FeatureFlagsApi post_approval_request POST /projects/projectKey/flags/featureFlagKey/environments/environmentKey/approval-requests/approvalRequestId Create an approval request for a feature flag config
LaunchDarklyApi::FeatureFlagsApi post_feature_flag POST /flags/projectKey Creates a new feature flag.
LaunchDarklyApi::FeatureFlagsApi post_flag_config_scheduled_changes POST /projects/projectKey/flags/featureFlagKey/environments/environmentKey/scheduled-changes Creates a new scheduled change for a feature flag.
LaunchDarklyApi::FeatureFlagsApi post_review_approval_request POST /projects/projectKey/flags/featureFlagKey/environments/environmentKey/approval-requests/approvalRequestId/review Review approval request for a feature flag config
LaunchDarklyApi::IntegrationsApi delete_integration_subscription DELETE /integrations/integrationKey/integrationId Delete an integration subscription by ID.
LaunchDarklyApi::IntegrationsApi get_integration_subscription GET /integrations/integrationKey/integrationId Get a single integration subscription by ID.
LaunchDarklyApi::IntegrationsApi get_integration_subscriptions GET /integrations/integrationKey Get a list of all configured integrations of a given kind.
LaunchDarklyApi::IntegrationsApi get_integrations GET /integrations Get a list of all configured audit log event integrations associated with this account.
LaunchDarklyApi::IntegrationsApi patch_integration_subscription PATCH /integrations/integrationKey/integrationId Modify an integration subscription by ID.
LaunchDarklyApi::IntegrationsApi post_integration_subscription POST /integrations/integrationKey Create a new integration subscription of a given kind.
LaunchDarklyApi::ProjectsApi delete_project DELETE /projects/projectKey Delete a project by key. Caution-- deleting a project will delete all associated environments and feature flags. You cannot delete the last project in an account.
LaunchDarklyApi::ProjectsApi get_project GET /projects/projectKey Fetch a single project by key.
LaunchDarklyApi::ProjectsApi get_projects GET /projects Returns a list of all projects in the account.
LaunchDarklyApi::ProjectsApi patch_project PATCH /projects/projectKey Modify a project by ID.
LaunchDarklyApi::ProjectsApi post_project POST /projects Create a new project with the given key and name.
LaunchDarklyApi::RelayProxyConfigurationsApi delete_relay_proxy_config DELETE /account/relay-auto-configs/id Delete a relay proxy configuration by ID.
LaunchDarklyApi::RelayProxyConfigurationsApi get_relay_proxy_config GET /account/relay-auto-configs/id Get a single relay proxy configuration by ID.
LaunchDarklyApi::RelayProxyConfigurationsApi get_relay_proxy_configs GET /account/relay-auto-configs Returns a list of relay proxy configurations in the account.
LaunchDarklyApi::RelayProxyConfigurationsApi patch_relay_proxy_config PATCH /account/relay-auto-configs/id Modify a relay proxy configuration by ID.
LaunchDarklyApi::RelayProxyConfigurationsApi post_relay_auto_config POST /account/relay-auto-configs Create a new relay proxy config.
LaunchDarklyApi::RelayProxyConfigurationsApi reset_relay_proxy_config POST /account/relay-auto-configs/id/reset Reset a relay proxy configuration's secret key with an optional expiry time for the old key.
LaunchDarklyApi::RootApi get_root GET /
LaunchDarklyApi::TeamMembersApi delete_member DELETE /members/memberId Delete a team member by ID.
LaunchDarklyApi::TeamMembersApi get_me GET /members/me Get the current team member associated with the token
LaunchDarklyApi::TeamMembersApi get_member GET /members/memberId Get a single team member by ID.
LaunchDarklyApi::TeamMembersApi get_members GET /members Returns a list of all members in the account.
LaunchDarklyApi::TeamMembersApi patch_member PATCH /members/memberId Modify a team member by ID.
LaunchDarklyApi::TeamMembersApi post_members POST /members Invite new members.
LaunchDarklyApi::UserSegmentsApi delete_user_segment DELETE /segments/projectKey/environmentKey/userSegmentKey Delete a user segment.
LaunchDarklyApi::UserSegmentsApi get_expiring_user_targets_on_segment GET /segments/projectKey/userSegmentKey/expiring-user-targets/environmentKey Get expiring user targets for user segment
LaunchDarklyApi::UserSegmentsApi get_user_segment GET /segments/projectKey/environmentKey/userSegmentKey Get a single user segment by key.
LaunchDarklyApi::UserSegmentsApi get_user_segments GET /segments/projectKey/environmentKey Get a list of all user segments in the given project.
LaunchDarklyApi::UserSegmentsApi patch_expiring_user_targets_on_segment PATCH /segments/projectKey/userSegmentKey/expiring-user-targets/environmentKey Update, add, or delete expiring user targets on user segment
LaunchDarklyApi::UserSegmentsApi patch_user_segment PATCH /segments/projectKey/environmentKey/userSegmentKey Perform a partial update to a user segment.
LaunchDarklyApi::UserSegmentsApi post_user_segment POST /segments/projectKey/environmentKey Creates a new user segment.
LaunchDarklyApi::UserSegmentsApi updated_unbounded_segment_targets POST /segments/projectKey/environmentKey/userSegmentKey/unbounded-users Update targets included or excluded in an unbounded segment
LaunchDarklyApi::UserSettingsApi get_expiring_user_targets_for_user GET /users/projectKey/userKey/expiring-user-targets/environmentKey Get expiring dates on flags for user
LaunchDarklyApi::UserSettingsApi get_user_flag_setting GET /users/projectKey/environmentKey/userKey/flags/featureFlagKey Fetch a single flag setting for a user by key.
LaunchDarklyApi::UserSettingsApi get_user_flag_settings GET /users/projectKey/environmentKey/userKey/flags Fetch a single flag setting for a user by key.
LaunchDarklyApi::UserSettingsApi patch_expiring_user_targets_for_flags PATCH /users/projectKey/userKey/expiring-user-targets/environmentKey Update, add, or delete expiring user targets for a single user on all flags
LaunchDarklyApi::UserSettingsApi put_flag_setting PUT /users/projectKey/environmentKey/userKey/flags/featureFlagKey Specifically enable or disable a feature flag for a user based on their key.
LaunchDarklyApi::UsersApi delete_user DELETE /users/projectKey/environmentKey/userKey Delete a user by ID.
LaunchDarklyApi::UsersApi get_search_users GET /user-search/projectKey/environmentKey Search users in LaunchDarkly based on their last active date, or a search query. It should not be used to enumerate all users in LaunchDarkly-- use the List users API resource.
LaunchDarklyApi::UsersApi get_user GET /users/projectKey/environmentKey/userKey Get a user by key.
LaunchDarklyApi::UsersApi get_users GET /users/projectKey/environmentKey List all users in the environment. Includes the total count of users. In each page, there will be up to 'limit' users returned (default 20). This is useful for exporting all users in the system for further analysis. Paginated collections will include a next link containing a URL with the next set of elements in the collection.
LaunchDarklyApi::WebhooksApi delete_webhook DELETE /webhooks/resourceId Delete a webhook by ID.
LaunchDarklyApi::WebhooksApi get_webhook GET /webhooks/resourceId Get a webhook by ID.
LaunchDarklyApi::WebhooksApi get_webhooks GET /webhooks Fetch a list of all webhooks.
LaunchDarklyApi::WebhooksApi patch_webhook PATCH /webhooks/resourceId Modify a webhook by ID.
LaunchDarklyApi::WebhooksApi post_webhook POST /webhooks Create a webhook.

Documentation for Models

Sample Code

# Load the gem
require 'launchdarkly_api'

# Setup authorization
LaunchDarklyApi.configure do |config|
  config.api_key['Authorization'] = ENV['LD_API_KEY']
end

api_instance = LaunchDarklyApi::FeatureFlagsApi.new

project_key = "openapi"
flag_key = "test-ruby"

# Create a flag with a json variations
body = LaunchDarklyApi::FeatureFlagBody.new(
  name: "test-ruby",
  key: flag_key,
  variations: [
    LaunchDarklyApi::Variation.new(value=[1,2]),
    LaunchDarklyApi::Variation.new(value=[3,4]),
    LaunchDarklyApi::Variation.new(value=[5]),
  ])

begin
  result = api_instance.post_feature_flag(project_key, body)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Exception creating feature flag: #{e}"
end

# Clean up new flag
begin
  result = api_instance.delete_feature_flag(project_key, flag_key)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Exception deleting feature flag: #{e}"
end```