Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

launchdarkly/api-client-bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 REST API Bash client - DEPRECATED

This project repo is no longer being maintained.

Other maintained API clients can be found under our LaunchDarkly Github Organization.

Overview

This is a Bash client script for accessing LaunchDarkly REST API service.

The script uses cURL underneath for making all REST calls.

Usage

# Make sure the script has executable rights
$ chmod u+x 

# Print the list of operations available on the service
$ ./ -h

# Print the service description
$ ./ --about

# Print detailed information about specific operation
$ ./ <operationId> -h

# Make GET request
./ --host http://<hostname>:<port> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>

# Make GET request using arbitrary curl options (must be passed before <operationId>) to an SSL service using username:password
 -k -sS --tlsv1.2 --host https://<hostname> -u <user>:<password> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>

# Make POST request
$ echo '<body_content>' |  --host <hostname> --content-type json <operationId> -

# Make POST request with simple JSON content, e.g.:
# {
#   "key1": "value1",
#   "key2": "value2",
#   "key3": 23
# }
$ echo '<body_content>' |  --host <hostname> --content-type json <operationId> key1==value1 key2=value2 key3:=23 -

# Preview the cURL command without actually executing it
$  --host http://<hostname>:<port> --dry-run <operationid>

Docker image

You can easily create a Docker image containing a preconfigured environment for using the REST Bash client including working autocompletion and short welcome message with basic instructions, using the generated Dockerfile:

docker build -t my-rest-client .
docker run -it my-rest-client

By default you will be logged into a Zsh environment which has much more advanced auto completion, but you can switch to Bash, where basic autocompletion is also available.

Shell completion

Bash

The generated bash-completion script can be either directly loaded to the current Bash session using:

source .bash-completion

Alternatively, the script can be copied to the /etc/bash-completion.d (or on OSX with Homebrew to /usr/local/etc/bash-completion.d):

sudo cp .bash-completion /etc/bash-completion.d/

OS X

On OSX you might need to install bash-completion using Homebrew:

brew install bash-completion

and add the following to the ~/.bashrc:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi

Zsh

In Zsh, the generated _ Zsh completion file must be copied to one of the folders under $FPATH variable.

Documentation for API Endpoints

All URIs are relative to /api/v2

Class Method HTTP request Description
AccessTokensApi deleteToken DELETE /tokens/{tokenId} Delete an access token by ID.
AccessTokensApi getToken GET /tokens/{tokenId} Get a single access token by ID.
AccessTokensApi getTokens GET /tokens Returns a list of tokens in the account.
AccessTokensApi patchToken PATCH /tokens/{tokenId} Modify an access token by ID.
AccessTokensApi postToken POST /tokens Create a new token.
AccessTokensApi resetToken POST /tokens/{tokenId}/reset Reset an access token's secret key with an optional expiry time for the old key.
AuditLogApi getAuditLogEntries 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.
AuditLogApi getAuditLogEntry GET /auditlog/{resourceId} Use this endpoint to fetch a single audit log entry by its resouce ID.
CustomRolesApi deleteCustomRole DELETE /roles/{customRoleKey} Delete a custom role by key.
CustomRolesApi getCustomRole GET /roles/{customRoleKey} Get one custom role by key.
CustomRolesApi getCustomRoles GET /roles Return a complete list of custom roles.
CustomRolesApi patchCustomRole PATCH /roles/{customRoleKey} Modify a custom role by key.
CustomRolesApi postCustomRole POST /roles Create a new custom role.
CustomerMetricsApi getEvaluations GET /usage/evaluations/{envId}/{flagKey} Get events usage by event id and the feature flag key.
CustomerMetricsApi getEvent GET /usage/events/{type} Get events usage by event type.
CustomerMetricsApi getEvents GET /usage/events Get events usage endpoints.
CustomerMetricsApi getMAU GET /usage/mau Get monthly active user data.
CustomerMetricsApi getMAUByCategory GET /usage/mau/bycategory Get monthly active user data by category.
CustomerMetricsApi getStream GET /usage/streams/{source} Get a stream endpoint and return timeseries data.
CustomerMetricsApi getStreamBySDK GET /usage/streams/{source}/bysdkversion Get a stream timeseries data by source show sdk version metadata.
CustomerMetricsApi getStreamSDKVersion GET /usage/streams/{source}/sdkversions Get a stream timeseries data by source and show all sdk version associated.
CustomerMetricsApi getStreams GET /usage/streams Returns a list of all streams.
CustomerMetricsApi getUsage GET /usage Returns of the usage endpoints available.
DataExportDestinationsApi deleteDestination DELETE /destinations/{projectKey}/{environmentKey}/{destinationId} Get a single data export destination by ID
DataExportDestinationsApi getDestination GET /destinations/{projectKey}/{environmentKey}/{destinationId} Get a single data export destination by ID
DataExportDestinationsApi getDestinations GET /destinations Returns a list of all data export destinations.
DataExportDestinationsApi patchDestination PATCH /destinations/{projectKey}/{environmentKey}/{destinationId} Perform a partial update to a data export destination.
DataExportDestinationsApi postDestination POST /destinations/{projectKey}/{environmentKey} Create a new data export destination
EnvironmentsApi deleteEnvironment DELETE /projects/{projectKey}/environments/{environmentKey} Delete an environment in a specific project.
EnvironmentsApi getEnvironment GET /projects/{projectKey}/environments/{environmentKey} Get an environment given a project and key.
EnvironmentsApi patchEnvironment PATCH /projects/{projectKey}/environments/{environmentKey} Modify an environment by ID. If you try to patch the environment by setting both required and requiredApprovalTags, it will result in an error. Users can specify either required approvals for all flags in an environment or those with specific tags, but not both. Only customers on an Enterprise plan can require approval for flag updates with either mechanism.
EnvironmentsApi postEnvironment POST /projects/{projectKey}/environments Create a new environment in a specified project with a given name, key, and swatch color.
EnvironmentsApi resetEnvironmentMobileKey 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.
EnvironmentsApi resetEnvironmentSDKKey POST /projects/{projectKey}/environments/{environmentKey}/apiKey Reset an environment's SDK key with an optional expiry time for the old key.
FeatureFlagsApi copyFeatureFlag POST /flags/{projectKey}/{featureFlagKey}/copy Copies the feature flag configuration from one environment to the same feature flag in another environment.
FeatureFlagsApi deleteApprovalRequest DELETE /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId} Delete an approval request for a feature flag config
FeatureFlagsApi deleteFeatureFlag 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.
FeatureFlagsApi deleteFlagConfigScheduledChanges DELETE /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId} Delete a scheduled change on a feature flag in an environment.
FeatureFlagsApi flagsProjectKeyEnvironmentKeyFeatureFlagKeyDependentFlagsGet GET /flags/{projectKey}/{environmentKey}/{featureFlagKey}/dependent-flags Get dependent flags for the flag in the environment specified in path parameters
FeatureFlagsApi flagsProjectKeyFeatureFlagKeyDependentFlagsGet GET /flags/{projectKey}/{featureFlagKey}/dependent-flags Get dependent flags across all environments for the flag specified in the path parameters
FeatureFlagsApi getApprovalRequest GET /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId} Get a single approval request for a feature flag config
FeatureFlagsApi getApprovalRequests GET /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests Get all approval requests for a feature flag config
FeatureFlagsApi getExpiringUserTargets GET /flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey} Get expiring user targets for feature flag
FeatureFlagsApi getFeatureFlag GET /flags/{projectKey}/{featureFlagKey} Get a single feature flag by key.
FeatureFlagsApi getFeatureFlagStatus GET /flag-statuses/{projectKey}/{environmentKey}/{featureFlagKey} Get the status for a particular feature flag.
FeatureFlagsApi getFeatureFlagStatusAcrossEnvironments GET /flag-status/{projectKey}/{featureFlagKey} Get the status for a particular feature flag across environments
FeatureFlagsApi getFeatureFlagStatuses 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.
FeatureFlagsApi getFeatureFlags GET /flags/{projectKey} Get a list of all features in the given project.
FeatureFlagsApi getFlagConfigScheduledChange GET /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId} Get a scheduled change on a feature flag by id.
FeatureFlagsApi getFlagConfigScheduledChanges GET /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes Get all scheduled workflows for a feature flag by key.
FeatureFlagsApi getFlagConfigScheduledChangesConflicts 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.
FeatureFlagsApi patchExpiringUserTargets PATCH /flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey} Update, add, or delete expiring user targets on feature flag
FeatureFlagsApi patchFeatureFlag PATCH /flags/{projectKey}/{featureFlagKey} Perform a partial update to a feature.
FeatureFlagsApi patchFlagConfigScheduledChange PATCH /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId} Updates an existing scheduled-change on a feature flag in an environment.
FeatureFlagsApi postApplyApprovalRequest POST /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}/apply Apply approval request for a feature flag config
FeatureFlagsApi postApprovalRequest POST /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId} Create an approval request for a feature flag config
FeatureFlagsApi postFeatureFlag POST /flags/{projectKey} Creates a new feature flag.
FeatureFlagsApi postFlagConfigScheduledChanges POST /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes Creates a new scheduled change for a feature flag.
FeatureFlagsApi postReviewApprovalRequest POST /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}/review Review approval request for a feature flag config
IntegrationsApi deleteIntegrationSubscription DELETE /integrations/{integrationKey}/{integrationId} Delete an integration subscription by ID.
IntegrationsApi getIntegrationSubscription GET /integrations/{integrationKey}/{integrationId} Get a single integration subscription by ID.
IntegrationsApi getIntegrationSubscriptions GET /integrations/{integrationKey} Get a list of all configured integrations of a given kind.
IntegrationsApi getIntegrations GET /integrations Get a list of all configured audit log event integrations associated with this account.
IntegrationsApi patchIntegrationSubscription PATCH /integrations/{integrationKey}/{integrationId} Modify an integration subscription by ID.
IntegrationsApi postIntegrationSubscription POST /integrations/{integrationKey} Create a new integration subscription of a given kind.
ProjectsApi deleteProject 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.
ProjectsApi getProject GET /projects/{projectKey} Fetch a single project by key.
ProjectsApi getProjects GET /projects Returns a list of all projects in the account.
ProjectsApi patchProject PATCH /projects/{projectKey} Modify a project by ID.
ProjectsApi postProject POST /projects Create a new project with the given key and name.
RelayProxyConfigurationsApi deleteRelayProxyConfig DELETE /account/relay-auto-configs/{id} Delete a relay proxy configuration by ID.
RelayProxyConfigurationsApi getRelayProxyConfig GET /account/relay-auto-configs/{id} Get a single relay proxy configuration by ID.
RelayProxyConfigurationsApi getRelayProxyConfigs GET /account/relay-auto-configs Returns a list of relay proxy configurations in the account.
RelayProxyConfigurationsApi patchRelayProxyConfig PATCH /account/relay-auto-configs/{id} Modify a relay proxy configuration by ID.
RelayProxyConfigurationsApi postRelayAutoConfig POST /account/relay-auto-configs Create a new relay proxy config.
RelayProxyConfigurationsApi resetRelayProxyConfig POST /account/relay-auto-configs/{id}/reset Reset a relay proxy configuration's secret key with an optional expiry time for the old key.
RootApi getRoot GET /
TeamMembersApi deleteMember DELETE /members/{memberId} Delete a team member by ID.
TeamMembersApi getMe GET /members/me Get the current team member associated with the token
TeamMembersApi getMember GET /members/{memberId} Get a single team member by ID.
TeamMembersApi getMembers GET /members Returns a list of all members in the account.
TeamMembersApi patchMember PATCH /members/{memberId} Modify a team member by ID.
TeamMembersApi postMembers POST /members Invite new members.
UserSegmentsApi deleteUserSegment DELETE /segments/{projectKey}/{environmentKey}/{userSegmentKey} Delete a user segment.
UserSegmentsApi getExpiringUserTargetsOnSegment GET /segments/{projectKey}/{userSegmentKey}/expiring-user-targets/{environmentKey} Get expiring user targets for user segment
UserSegmentsApi getUserSegment GET /segments/{projectKey}/{environmentKey}/{userSegmentKey} Get a single user segment by key.
UserSegmentsApi getUserSegments GET /segments/{projectKey}/{environmentKey} Get a list of all user segments in the given project.
UserSegmentsApi patchExpiringUserTargetsOnSegment PATCH /segments/{projectKey}/{userSegmentKey}/expiring-user-targets/{environmentKey} Update, add, or delete expiring user targets on user segment
UserSegmentsApi patchUserSegment PATCH /segments/{projectKey}/{environmentKey}/{userSegmentKey} Perform a partial update to a user segment.
UserSegmentsApi postUserSegment POST /segments/{projectKey}/{environmentKey} Creates a new user segment.
UserSegmentsApi updateBigSegmentTargets POST /segments/{projectKey}/{environmentKey}/{userSegmentKey}/users Update targets included or excluded in a big segment
UserSettingsApi getExpiringUserTargetsForUser GET /users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} Get expiring dates on flags for user
UserSettingsApi getUserFlagSetting GET /users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} Fetch a single flag setting for a user by key.
UserSettingsApi getUserFlagSettings GET /users/{projectKey}/{environmentKey}/{userKey}/flags Fetch a single flag setting for a user by key.
UserSettingsApi patchExpiringUserTargetsForFlags PATCH /users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} Update, add, or delete expiring user targets for a single user on all flags
UserSettingsApi putFlagSetting PUT /users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} Specifically enable or disable a feature flag for a user based on their key.
UsersApi deleteUser DELETE /users/{projectKey}/{environmentKey}/{userKey} Delete a user by ID.
UsersApi getSearchUsers 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.
UsersApi getUser GET /users/{projectKey}/{environmentKey}/{userKey} Get a user by key.
UsersApi getUsers 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.
WebhooksApi deleteWebhook DELETE /webhooks/{resourceId} Delete a webhook by ID.
WebhooksApi getWebhook GET /webhooks/{resourceId} Get a webhook by ID.
WebhooksApi getWebhooks GET /webhooks Fetch a list of all webhooks.
WebhooksApi patchWebhook PATCH /webhooks/{resourceId} Modify a webhook by ID.
WebhooksApi postWebhook POST /webhooks Create a webhook.

Documentation For Models

Documentation For Authorization

Token

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header