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: 2.0.33
- Package version: 2.0.33
- 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-2.0.33.gem
(for development, run gem install --dev ./launchdarkly_api-2.0.33.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', '~> 2.0.33'
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::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::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_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 | 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 | patch_feature_flag | PATCH /flags/projectKey/featureFlagKey | Perform a partial update to a feature. |
LaunchDarklyApi::FeatureFlagsApi | post_feature_flag | POST /flags/projectKey | Creates a new feature flag. |
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::RootApi | get_root | GET / | |
LaunchDarklyApi::TeamMembersApi | delete_member | DELETE /members/memberId | Delete a team member by ID. |
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_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_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::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 | 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
- LaunchDarklyApi::AuditLogEntries
- LaunchDarklyApi::AuditLogEntry
- LaunchDarklyApi::AuditLogEntryTarget
- LaunchDarklyApi::Clause
- LaunchDarklyApi::CopyActions
- LaunchDarklyApi::CustomProperty
- LaunchDarklyApi::CustomPropertyValues
- LaunchDarklyApi::CustomRole
- LaunchDarklyApi::CustomRoleBody
- LaunchDarklyApi::CustomRoles
- LaunchDarklyApi::Defaults
- LaunchDarklyApi::Destination
- LaunchDarklyApi::DestinationAmazonKinesis
- LaunchDarklyApi::DestinationBody
- LaunchDarklyApi::DestinationGooglePubSub
- LaunchDarklyApi::DestinationMParticle
- LaunchDarklyApi::DestinationSegment
- LaunchDarklyApi::Destinations
- LaunchDarklyApi::Environment
- LaunchDarklyApi::EnvironmentPost
- LaunchDarklyApi::EvaluationUsageError
- LaunchDarklyApi::Events
- LaunchDarklyApi::Fallthrough
- LaunchDarklyApi::FeatureFlag
- LaunchDarklyApi::FeatureFlagBody
- LaunchDarklyApi::FeatureFlagConfig
- LaunchDarklyApi::FeatureFlagCopyBody
- LaunchDarklyApi::FeatureFlagCopyObject
- LaunchDarklyApi::FeatureFlagStatus
- LaunchDarklyApi::FeatureFlagStatusAcrossEnvironments
- LaunchDarklyApi::FeatureFlagStatusForQueriedEnvironment
- LaunchDarklyApi::FeatureFlagStatuses
- LaunchDarklyApi::FeatureFlags
- LaunchDarklyApi::FlagListItem
- LaunchDarklyApi::Id
- LaunchDarklyApi::Link
- LaunchDarklyApi::Links
- LaunchDarklyApi::MAU
- LaunchDarklyApi::MAUMetadata
- LaunchDarklyApi::MAUbyCategory
- LaunchDarklyApi::Member
- LaunchDarklyApi::Members
- LaunchDarklyApi::MembersBody
- LaunchDarklyApi::PatchComment
- LaunchDarklyApi::PatchOperation
- LaunchDarklyApi::Policy
- LaunchDarklyApi::Prerequisite
- LaunchDarklyApi::Project
- LaunchDarklyApi::ProjectBody
- LaunchDarklyApi::Projects
- LaunchDarklyApi::Role
- LaunchDarklyApi::Rollout
- LaunchDarklyApi::Rule
- LaunchDarklyApi::Site
- LaunchDarklyApi::Statement
- LaunchDarklyApi::Stream
- LaunchDarklyApi::StreamBySDK
- LaunchDarklyApi::StreamBySDKLinks
- LaunchDarklyApi::StreamBySDKLinksMetadata
- LaunchDarklyApi::StreamLinks
- LaunchDarklyApi::StreamSDKVersion
- LaunchDarklyApi::StreamSDKVersionData
- LaunchDarklyApi::StreamUsageError
- LaunchDarklyApi::StreamUsageLinks
- LaunchDarklyApi::StreamUsageMetadata
- LaunchDarklyApi::StreamUsageSeries
- LaunchDarklyApi::Streams
- LaunchDarklyApi::Target
- LaunchDarklyApi::Usage
- LaunchDarklyApi::UsageError
- LaunchDarklyApi::UsageLinks
- LaunchDarklyApi::User
- LaunchDarklyApi::UserFlagSetting
- LaunchDarklyApi::UserFlagSettings
- LaunchDarklyApi::UserRecord
- LaunchDarklyApi::UserSegment
- LaunchDarklyApi::UserSegmentBody
- LaunchDarklyApi::UserSegmentRule
- LaunchDarklyApi::UserSegments
- LaunchDarklyApi::UserSettingsBody
- LaunchDarklyApi::Users
- LaunchDarklyApi::Variation
- LaunchDarklyApi::Webhook
- LaunchDarklyApi::WebhookBody
- LaunchDarklyApi::Webhooks
- LaunchDarklyApi::WeightedVariation
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```