Class: LaunchDarklyApi::FeatureFlagsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/launchdarkly_api/api/feature_flags_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FeatureFlagsApi

Returns a new instance of FeatureFlagsApi.



19
20
21
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#copy_feature_flag(project_key, feature_flag_key, flag_copy_config_post, opts = {}) ⇒ FeatureFlag

Copy feature flag

> ### Copying flag settings is an Enterprise feature > > Copying flag settings is available to customers on an Enterprise plan. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/).  Copy flag settings from a source environment to a target environment.  By default, this operation copies the entire flag configuration. You can use the `includedActions` or `excludedActions` to specify that only part of the flag configuration is copied.  If you provide the optional `currentVersion` of a flag, this operation tests to ensure that the current flag version in the environment matches the version you've specified. The operation rejects attempts to copy flag settings if the environment's current version  of the flag does not match the version you've specified. You can use this to enforce optimistic locking on copy attempts.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key. The key identifies the flag in your code.

  • flag_copy_config_post (FlagCopyConfigPost)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



29
30
31
32
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 29

def copy_feature_flag(project_key, feature_flag_key, flag_copy_config_post, opts = {})
  data, _status_code, _headers = copy_feature_flag_with_http_info(project_key, feature_flag_key, flag_copy_config_post, opts)
  data
end

#copy_feature_flag_with_http_info(project_key, feature_flag_key, flag_copy_config_post, opts = {}) ⇒ Array<(FeatureFlag, Integer, Hash)>

Copy feature flag

&gt; ### Copying flag settings is an Enterprise feature &gt; &gt; Copying flag settings is available to customers on an Enterprise plan. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/).  Copy flag settings from a source environment to a target environment.  By default, this operation copies the entire flag configuration. You can use the &#x60;includedActions&#x60; or &#x60;excludedActions&#x60; to specify that only part of the flag configuration is copied.  If you provide the optional &#x60;currentVersion&#x60; of a flag, this operation tests to ensure that the current flag version in the environment matches the version you&#39;ve specified. The operation rejects attempts to copy flag settings if the environment&#39;s current version  of the flag does not match the version you&#39;ve specified. You can use this to enforce optimistic locking on copy attempts.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key. The key identifies the flag in your code.

  • flag_copy_config_post (FlagCopyConfigPost)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FeatureFlag, Integer, Hash)>)

    FeatureFlag data, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 41

def copy_feature_flag_with_http_info(project_key, feature_flag_key, flag_copy_config_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.copy_feature_flag ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.copy_feature_flag"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.copy_feature_flag"
  end
  # verify the required parameter 'flag_copy_config_post' is set
  if @api_client.config.client_side_validation && flag_copy_config_post.nil?
    fail ArgumentError, "Missing the required parameter 'flag_copy_config_post' when calling FeatureFlagsApi.copy_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}/{featureFlagKey}/copy'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(flag_copy_config_post)

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlag'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.copy_feature_flag",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#copy_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_feature_flag(project_key, feature_flag_key, opts = {}) ⇒ nil

Delete feature flag Delete a feature flag in all environments. Use with caution: only delete feature flags your application no longer uses.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


108
109
110
111
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 108

def delete_feature_flag(project_key, feature_flag_key, opts = {})
  delete_feature_flag_with_http_info(project_key, feature_flag_key, opts)
  nil
end

#delete_feature_flag_with_http_info(project_key, feature_flag_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete feature flag Delete a feature flag in all environments. Use with caution: only delete feature flags your application no longer uses.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 119

def delete_feature_flag_with_http_info(project_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.delete_feature_flag ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.delete_feature_flag"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.delete_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.delete_feature_flag",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#delete_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_expiring_context_targets(project_key, environment_key, feature_flag_key, opts = {}) ⇒ ExpiringTargetGetResponse

Get expiring context targets for feature flag Get a list of context targets on a feature flag that are scheduled for removal.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



178
179
180
181
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 178

def get_expiring_context_targets(project_key, environment_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_expiring_context_targets_with_http_info(project_key, environment_key, feature_flag_key, opts)
  data
end

#get_expiring_context_targets_with_http_info(project_key, environment_key, feature_flag_key, opts = {}) ⇒ Array<(ExpiringTargetGetResponse, Integer, Hash)>

Get expiring context targets for feature flag Get a list of context targets on a feature flag that are scheduled for removal.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ExpiringTargetGetResponse, Integer, Hash)>)

    ExpiringTargetGetResponse data, response status code and response headers



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 190

def get_expiring_context_targets_with_http_info(project_key, environment_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_expiring_context_targets ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.get_expiring_context_targets"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling FeatureFlagsApi.get_expiring_context_targets"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.get_expiring_context_targets"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ExpiringTargetGetResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_expiring_context_targets",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_expiring_context_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_expiring_user_targets(project_key, environment_key, feature_flag_key, opts = {}) ⇒ ExpiringUserTargetGetResponse

Get expiring user targets for feature flag

> ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring context targets for feature flag](/tag/Feature-flags#operation/getExpiringContextTargets) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/contexts).  Get a list of user targets on a feature flag that are scheduled for removal.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



253
254
255
256
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 253

def get_expiring_user_targets(project_key, environment_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, opts)
  data
end

#get_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, opts = {}) ⇒ Array<(ExpiringUserTargetGetResponse, Integer, Hash)>

Get expiring user targets for feature flag

&gt; ### Contexts are now available &gt; &gt; After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring context targets for feature flag](/tag/Feature-flags#operation/getExpiringContextTargets) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/contexts).  Get a list of user targets on a feature flag that are scheduled for removal.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 265

def get_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_expiring_user_targets ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.get_expiring_user_targets"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling FeatureFlagsApi.get_expiring_user_targets"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.get_expiring_user_targets"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ExpiringUserTargetGetResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_expiring_user_targets",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_expiring_user_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flag(project_key, feature_flag_key, opts = {}) ⇒ FeatureFlag

Get feature flag Get a single feature flag by key. By default, this returns the configurations for all environments. You can filter environments with the ‘env` query parameter. For example, setting `env=production` restricts the returned configurations to just the `production` environment.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (String)

    Filter configurations by environment

Returns:



328
329
330
331
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 328

def get_feature_flag(project_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_feature_flag_with_http_info(project_key, feature_flag_key, opts)
  data
end

#get_feature_flag_status(project_key, environment_key, feature_flag_key, opts = {}) ⇒ FlagStatusRep

Get feature flag status Get the status for a particular feature flag.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



400
401
402
403
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 400

def get_feature_flag_status(project_key, environment_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_feature_flag_status_with_http_info(project_key, environment_key, feature_flag_key, opts)
  data
end

#get_feature_flag_status_across_environments(project_key, feature_flag_key, opts = {}) ⇒ FeatureFlagStatusAcrossEnvironments

Get flag status across environments Get the status for a particular feature flag across environments.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (String)

    Optional environment filter

Returns:



475
476
477
478
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 475

def get_feature_flag_status_across_environments(project_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_feature_flag_status_across_environments_with_http_info(project_key, feature_flag_key, opts)
  data
end

#get_feature_flag_status_across_environments_with_http_info(project_key, feature_flag_key, opts = {}) ⇒ Array<(FeatureFlagStatusAcrossEnvironments, Integer, Hash)>

Get flag status across environments Get the status for a particular feature flag across environments.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (String)

    Optional environment filter

Returns:



487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 487

def get_feature_flag_status_across_environments_with_http_info(project_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag_status_across_environments ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.get_feature_flag_status_across_environments"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.get_feature_flag_status_across_environments"
  end
  # resource path
  local_var_path = '/api/v2/flag-status/{projectKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'env'] = opts[:'env'] if !opts[:'env'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlagStatusAcrossEnvironments'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flag_status_across_environments",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flag_status_across_environments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flag_status_with_http_info(project_key, environment_key, feature_flag_key, opts = {}) ⇒ Array<(FlagStatusRep, Integer, Hash)>

Get feature flag status Get the status for a particular feature flag.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FlagStatusRep, Integer, Hash)>)

    FlagStatusRep data, response status code and response headers



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 412

def get_feature_flag_status_with_http_info(project_key, environment_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag_status ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.get_feature_flag_status"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling FeatureFlagsApi.get_feature_flag_status"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.get_feature_flag_status"
  end
  # resource path
  local_var_path = '/api/v2/flag-statuses/{projectKey}/{environmentKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FlagStatusRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flag_status",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flag_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flag_statuses(project_key, environment_key, opts = {}) ⇒ FeatureFlagStatuses

List feature flag statuses Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as a state, which is one of the following: - ‘new`: the feature flag was created within the last seven days, and has not been requested yet - `active`: the feature flag was requested within the last seven days - `inactive`: the feature flag was created more than seven days ago, and hasn’t been requested within the past seven days - ‘launched`: one variation of the feature flag has been rolled out for at least seven days

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



546
547
548
549
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 546

def get_feature_flag_statuses(project_key, environment_key, opts = {})
  data, _status_code, _headers = get_feature_flag_statuses_with_http_info(project_key, environment_key, opts)
  data
end

#get_feature_flag_statuses_with_http_info(project_key, environment_key, opts = {}) ⇒ Array<(FeatureFlagStatuses, Integer, Hash)>

List feature flag statuses Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as a state, which is one of the following: - &#x60;new&#x60;: the feature flag was created within the last seven days, and has not been requested yet - &#x60;active&#x60;: the feature flag was requested within the last seven days - &#x60;inactive&#x60;: the feature flag was created more than seven days ago, and hasn&#39;t been requested within the past seven days - &#x60;launched&#x60;: one variation of the feature flag has been rolled out for at least seven days

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FeatureFlagStatuses, Integer, Hash)>)

    FeatureFlagStatuses data, response status code and response headers



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 557

def get_feature_flag_statuses_with_http_info(project_key, environment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag_statuses ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.get_feature_flag_statuses"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling FeatureFlagsApi.get_feature_flag_statuses"
  end
  # resource path
  local_var_path = '/api/v2/flag-statuses/{projectKey}/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlagStatuses'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flag_statuses",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flag_statuses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flag_with_http_info(project_key, feature_flag_key, opts = {}) ⇒ Array<(FeatureFlag, Integer, Hash)>

Get feature flag Get a single feature flag by key. By default, this returns the configurations for all environments. You can filter environments with the &#x60;env&#x60; query parameter. For example, setting &#x60;env&#x3D;production&#x60; restricts the returned configurations to just the &#x60;production&#x60; environment.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (String)

    Filter configurations by environment

Returns:

  • (Array<(FeatureFlag, Integer, Hash)>)

    FeatureFlag data, response status code and response headers



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 340

def get_feature_flag_with_http_info(project_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.get_feature_flag"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.get_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'env'] = opts[:'env'] if !opts[:'env'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlag'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flag",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flags(project_key, opts = {}) ⇒ FeatureFlags

List feature flags Get a list of all features in the given project. By default, each feature includes configurations for each environment. You can filter environments with the ‘env` query parameter. For example, setting `env=production` restricts the returned configurations to just your production environment. You can also filter feature flags by tag with the tag query parameter. ### Filtering flags You can filter on certain fields using the `filter` query parameter. For example, setting `filter=query:dark-mode,tags:beta+test` matches flags with the string `dark-mode` in their key or name, ignoring case, which also have the tags `beta` and `test`. The `filter` query parameter supports the following arguments: - `query` is a string that matches against the flags’ keys and names. It is not case sensitive. - ‘archived` is a boolean with values of `true` or `false` that filters the list to archived flags. Setting the value to `true` returns only archived flags. When this is absent, only unarchived flags are returned. - `type` is a string allowing filtering to `temporary` or `permanent` flags. - `status` is a string allowing filtering to `new`, `inactive`, `active`, or `launched` flags in the specified environment. This filter also requires a `filterEnv` field to be set to a valid environment. For example: `filter=status:active,filterEnv:production`. - `tags` is a `+` separated list of tags. It filters the list to members who have all of the tags in the list. For example: `filter=tags:beta+test`. - `hasExperiment` is a boolean with values of `true` or `false` that returns any flags that are used in an experiment. - `hasDataExport` is a boolean with values of `true` or `false` that returns any flags that are exporting data in the specified environment. This includes flags that are exporting data from Experimentation. This filter also requires that you set a `filterEnv` field to a valid environment key. For example: `filter=hasDataExport:true,filterEnv:production` - `evaluated` is an object that contains a key of `after` and a value in Unix time in milliseconds. This returns all flags that have been evaluated since the time you specify in the environment provided. This filter also requires you to set a `filterEnv` field to a valid environment. For example: `filter=evaluated:1590768455282,filterEnv:production`. - `filterEnv` is a string with the key of a valid environment. You can use the `filterEnv` field for filters that are environment-specific. If there are multiple environment-specific filters, you should only declare this parameter once. For example: `filter=evaluated:1590768455282,filterEnv:production,status:active`. By default, this returns all flags. You can page through the list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the returned `_links` field. These links will not be present if the pages they refer to don’t exist. For example, the ‘first` and `prev` links will be missing from the response on the first page. ### Sorting flags You can sort flags based on the following fields: - `creationDate` sorts by the creation date of the flag. - `key` sorts by the key of the flag. - `maintainerId` sorts by the flag maintainer. - `name` sorts by flag name. - `tags` sorts by tags. - `targetingModifiedDate` sorts by the date that the flag’s targeting rules were last modified in a given environment. It must be used with ‘env` parameter and it can not be combined with any other sort. If multiple `env` values are provided, it will perform sort using the first one. For example, `sort=-targetingModifiedDate&env=production&env=staging` returns results sorted by `targetingModifiedDate` for the `production` environment. - `type` sorts by flag type All fields are sorted in ascending order by default. To sort in descending order, prefix the field with a dash ( - ). For example, `sort=-name` sorts the response by flag name in descending order.

Parameters:

  • project_key (String)

    The project key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (String)

    Filter configurations by environment

  • :tag (String)

    Filter feature flags by tag

  • :limit (Integer)

    The number of feature flags to return. Defaults to -1, which returns all flags

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

  • :archived (Boolean)

    A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned

  • :summary (Boolean)

    By default in API version &gt;&#x3D; 1, flags will not include their list of prerequisites, targets or rules. Set summary&#x3D;0 to include these fields for each flag returned

  • :filter (String)

    A comma-separated list of filters. Each filter is of the form field:value. Read the endpoint description for a full list of available filter fields.

  • :sort (String)

    A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. Read the endpoint description for a full list of available sort fields.

  • :compare (Boolean)

    A boolean to filter results by only flags that have differences between environments

Returns:



623
624
625
626
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 623

def get_feature_flags(project_key, opts = {})
  data, _status_code, _headers = get_feature_flags_with_http_info(project_key, opts)
  data
end

#get_feature_flags_with_http_info(project_key, opts = {}) ⇒ Array<(FeatureFlags, Integer, Hash)>

List feature flags Get a list of all features in the given project. By default, each feature includes configurations for each environment. You can filter environments with the &#x60;env&#x60; query parameter. For example, setting &#x60;env&#x3D;production&#x60; restricts the returned configurations to just your production environment. You can also filter feature flags by tag with the tag query parameter. ### Filtering flags You can filter on certain fields using the &#x60;filter&#x60; query parameter. For example, setting &#x60;filter&#x3D;query:dark-mode,tags:beta+test&#x60; matches flags with the string &#x60;dark-mode&#x60; in their key or name, ignoring case, which also have the tags &#x60;beta&#x60; and &#x60;test&#x60;. The &#x60;filter&#x60; query parameter supports the following arguments: - &#x60;query&#x60; is a string that matches against the flags&#39; keys and names. It is not case sensitive. - &#x60;archived&#x60; is a boolean with values of &#x60;true&#x60; or &#x60;false&#x60; that filters the list to archived flags. Setting the value to &#x60;true&#x60; returns only archived flags. When this is absent, only unarchived flags are returned. - &#x60;type&#x60; is a string allowing filtering to &#x60;temporary&#x60; or &#x60;permanent&#x60; flags. - &#x60;status&#x60; is a string allowing filtering to &#x60;new&#x60;, &#x60;inactive&#x60;, &#x60;active&#x60;, or &#x60;launched&#x60; flags in the specified environment. This filter also requires a &#x60;filterEnv&#x60; field to be set to a valid environment. For example: &#x60;filter&#x3D;status:active,filterEnv:production&#x60;. - &#x60;tags&#x60; is a &#x60;+&#x60; separated list of tags. It filters the list to members who have all of the tags in the list. For example: &#x60;filter&#x3D;tags:beta+test&#x60;. - &#x60;hasExperiment&#x60; is a boolean with values of &#x60;true&#x60; or &#x60;false&#x60; that returns any flags that are used in an experiment. - &#x60;hasDataExport&#x60; is a boolean with values of &#x60;true&#x60; or &#x60;false&#x60; that returns any flags that are exporting data in the specified environment. This includes flags that are exporting data from Experimentation. This filter also requires that you set a &#x60;filterEnv&#x60; field to a valid environment key. For example: &#x60;filter&#x3D;hasDataExport:true,filterEnv:production&#x60; - &#x60;evaluated&#x60; is an object that contains a key of &#x60;after&#x60; and a value in Unix time in milliseconds. This returns all flags that have been evaluated since the time you specify in the environment provided. This filter also requires you to set a &#x60;filterEnv&#x60; field to a valid environment. For example: &#x60;filter&#x3D;evaluated:1590768455282,filterEnv:production&#x60;. - &#x60;filterEnv&#x60; is a string with the key of a valid environment. You can use the &#x60;filterEnv&#x60; field for filters that are environment-specific. If there are multiple environment-specific filters, you should only declare this parameter once. For example: &#x60;filter&#x3D;evaluated:1590768455282,filterEnv:production,status:active&#x60;. By default, this returns all flags. You can page through the list with the &#x60;limit&#x60; parameter and by following the &#x60;first&#x60;, &#x60;prev&#x60;, &#x60;next&#x60;, and &#x60;last&#x60; links in the returned &#x60;_links&#x60; field. These links will not be present if the pages they refer to don&#39;t exist. For example, the &#x60;first&#x60; and &#x60;prev&#x60; links will be missing from the response on the first page. ### Sorting flags You can sort flags based on the following fields: - &#x60;creationDate&#x60; sorts by the creation date of the flag. - &#x60;key&#x60; sorts by the key of the flag. - &#x60;maintainerId&#x60; sorts by the flag maintainer. - &#x60;name&#x60; sorts by flag name. - &#x60;tags&#x60; sorts by tags. - &#x60;targetingModifiedDate&#x60; sorts by the date that the flag&#39;s targeting rules were last modified in a given environment. It must be used with &#x60;env&#x60; parameter and it can not be combined with any other sort. If multiple &#x60;env&#x60; values are provided, it will perform sort using the first one. For example, &#x60;sort&#x3D;-targetingModifiedDate&amp;env&#x3D;production&amp;env&#x3D;staging&#x60; returns results sorted by &#x60;targetingModifiedDate&#x60; for the &#x60;production&#x60; environment. - &#x60;type&#x60; sorts by flag type All fields are sorted in ascending order by default. To sort in descending order, prefix the field with a dash ( - ). For example, &#x60;sort&#x3D;-name&#x60; sorts the response by flag name in descending order.

Parameters:

  • project_key (String)

    The project key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (String)

    Filter configurations by environment

  • :tag (String)

    Filter feature flags by tag

  • :limit (Integer)

    The number of feature flags to return. Defaults to -1, which returns all flags

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

  • :archived (Boolean)

    A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned

  • :summary (Boolean)

    By default in API version &gt;&#x3D; 1, flags will not include their list of prerequisites, targets or rules. Set summary&#x3D;0 to include these fields for each flag returned

  • :filter (String)

    A comma-separated list of filters. Each filter is of the form field:value. Read the endpoint description for a full list of available filter fields.

  • :sort (String)

    A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. Read the endpoint description for a full list of available sort fields.

  • :compare (Boolean)

    A boolean to filter results by only flags that have differences between environments

Returns:

  • (Array<(FeatureFlags, Integer, Hash)>)

    FeatureFlags data, response status code and response headers



642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 642

def get_feature_flags_with_http_info(project_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flags ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.get_feature_flags"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'env'] = opts[:'env'] if !opts[:'env'].nil?
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?
  query_params[:'summary'] = opts[:'summary'] if !opts[:'summary'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'compare'] = opts[:'compare'] if !opts[:'compare'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlags'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flags",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_expiring_targets(project_key, environment_key, feature_flag_key, patch_flags_request, opts = {}) ⇒ ExpiringTargetPatchResponse

Update expiring context targets on feature flag Schedule a context for removal from individual targeting on a feature flag. The flag must already individually target the context. You can add, update, or remove a scheduled removal date. You can only schedule a context for removal on a single variation per flag. This request only supports semantic patches. 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](/reference#updates-using-semantic-patch). ### Instructions #### addExpiringTarget Adds a date and time that LaunchDarkly will remove the context from the flag’s individual targeting. ##### Parameters * ‘value`: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * `variationId`: The version of the flag variation to update. You can retrieve this by making a GET request for the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` #### updateExpiringTarget Updates the date and time that LaunchDarkly will remove the context from the flag’s individual targeting ##### Parameters * ‘value`: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * `variationId`: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` #### removeExpiringTarget Removes the scheduled removal of the context from the flag’s individual targeting. The context will remain part of the flag’s individual targeting until you explicitly remove them, or until you schedule another removal. ##### Parameters * ‘variationId`: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey`

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • patch_flags_request (PatchFlagsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



707
708
709
710
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 707

def patch_expiring_targets(project_key, environment_key, feature_flag_key, patch_flags_request, opts = {})
  data, _status_code, _headers = patch_expiring_targets_with_http_info(project_key, environment_key, feature_flag_key, patch_flags_request, opts)
  data
end

#patch_expiring_targets_with_http_info(project_key, environment_key, feature_flag_key, patch_flags_request, opts = {}) ⇒ Array<(ExpiringTargetPatchResponse, Integer, Hash)>

Update expiring context targets on feature flag Schedule a context for removal from individual targeting on a feature flag. The flag must already individually target the context. You can add, update, or remove a scheduled removal date. You can only schedule a context for removal on a single variation per flag. This request only supports semantic patches. To make a semantic patch request, you must append &#x60;domain-model&#x3D;launchdarkly.semanticpatch&#x60; to your &#x60;Content-Type&#x60; header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). ### Instructions #### addExpiringTarget Adds a date and time that LaunchDarkly will remove the context from the flag&#39;s individual targeting. ##### Parameters * &#x60;value&#x60;: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * &#x60;variationId&#x60;: The version of the flag variation to update. You can retrieve this by making a GET request for the flag * &#x60;contextKey&#x60;: The context key for the context to remove from individual targeting * &#x60;contextKind&#x60;: The kind of context represented by the &#x60;contextKey&#x60; #### updateExpiringTarget Updates the date and time that LaunchDarkly will remove the context from the flag&#39;s individual targeting ##### Parameters * &#x60;value&#x60;: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * &#x60;variationId&#x60;: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * &#x60;contextKey&#x60;: The context key for the context to remove from individual targeting * &#x60;contextKind&#x60;: The kind of context represented by the &#x60;contextKey&#x60; #### removeExpiringTarget Removes the scheduled removal of the context from the flag&#39;s individual targeting. The context will remain part of the flag&#39;s individual targeting until you explicitly remove them, or until you schedule another removal. ##### Parameters * &#x60;variationId&#x60;: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * &#x60;contextKey&#x60;: The context key for the context to remove from individual targeting * &#x60;contextKind&#x60;: The kind of context represented by the &#x60;contextKey&#x60;

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • patch_flags_request (PatchFlagsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ExpiringTargetPatchResponse, Integer, Hash)>)

    ExpiringTargetPatchResponse data, response status code and response headers



720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 720

def patch_expiring_targets_with_http_info(project_key, environment_key, feature_flag_key, patch_flags_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.patch_expiring_targets ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.patch_expiring_targets"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling FeatureFlagsApi.patch_expiring_targets"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.patch_expiring_targets"
  end
  # verify the required parameter 'patch_flags_request' is set
  if @api_client.config.client_side_validation && patch_flags_request.nil?
    fail ArgumentError, "Missing the required parameter 'patch_flags_request' when calling FeatureFlagsApi.patch_expiring_targets"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(patch_flags_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ExpiringTargetPatchResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.patch_expiring_targets",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#patch_expiring_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_expiring_user_targets(project_key, environment_key, feature_flag_key, patch_flags_request, opts = {}) ⇒ ExpiringUserTargetPatchResponse

Update expiring user targets on feature flag > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring context targets on feature flag](/tag/Feature-flags#operation/patchExpiringTargets) instead of this endpoint. To learn more, read [Contexts](docs.launchdarkly.com/home/contexts). Schedule a target for removal from individual targeting on a feature flag. The flag must already serve a variation to specific targets based on their key. You can add, update, or remove a scheduled removal date. You can only schedule a target for removal on a single variation per flag. This request only supports semantic patches. 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](/reference#updates-using-semantic-patch). ### Instructions #### addExpireUserTargetDate Adds a date and time that LaunchDarkly will remove the user from the flag’s individual targeting. ##### Parameters * ‘value`: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * `variationId`: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * `userKey`: The user key for the user to remove from individual targeting #### updateExpireUserTargetDate Updates the date and time that LaunchDarkly will remove the user from the flag’s individual targeting. ##### Parameters * ‘value`: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * `variationId`: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * `userKey`: The user key for the user to remove from individual targeting #### removeExpireUserTargetDate Removes the scheduled removal of the user from the flag’s individual targeting. The user will remain part of the flag’s individual targeting until you explicitly remove them, or until you schedule another removal. ##### Parameters * ‘variationId`: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * `userKey`: The user key for the user to remove from individual targeting

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • patch_flags_request (PatchFlagsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



793
794
795
796
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 793

def patch_expiring_user_targets(project_key, environment_key, feature_flag_key, patch_flags_request, opts = {})
  data, _status_code, _headers = patch_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, patch_flags_request, opts)
  data
end

#patch_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, patch_flags_request, opts = {}) ⇒ Array<(ExpiringUserTargetPatchResponse, Integer, Hash)>

Update expiring user targets on feature flag &gt; ### Contexts are now available &gt; &gt; After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring context targets on feature flag](/tag/Feature-flags#operation/patchExpiringTargets) instead of this endpoint. To learn more, read [Contexts](docs.launchdarkly.com/home/contexts). Schedule a target for removal from individual targeting on a feature flag. The flag must already serve a variation to specific targets based on their key. You can add, update, or remove a scheduled removal date. You can only schedule a target for removal on a single variation per flag. This request only supports semantic patches. To make a semantic patch request, you must append &#x60;domain-model&#x3D;launchdarkly.semanticpatch&#x60; to your &#x60;Content-Type&#x60; header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). ### Instructions #### addExpireUserTargetDate Adds a date and time that LaunchDarkly will remove the user from the flag&#39;s individual targeting. ##### Parameters * &#x60;value&#x60;: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * &#x60;variationId&#x60;: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * &#x60;userKey&#x60;: The user key for the user to remove from individual targeting #### updateExpireUserTargetDate Updates the date and time that LaunchDarkly will remove the user from the flag&#39;s individual targeting. ##### Parameters * &#x60;value&#x60;: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * &#x60;variationId&#x60;: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * &#x60;userKey&#x60;: The user key for the user to remove from individual targeting #### removeExpireUserTargetDate Removes the scheduled removal of the user from the flag&#39;s individual targeting. The user will remain part of the flag&#39;s individual targeting until you explicitly remove them, or until you schedule another removal. ##### Parameters * &#x60;variationId&#x60;: The version of the flag variation to update. You can retrieve this by making a GET request for the flag. * &#x60;userKey&#x60;: The user key for the user to remove from individual targeting

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • feature_flag_key (String)

    The feature flag key

  • patch_flags_request (PatchFlagsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 806

def patch_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, patch_flags_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.patch_expiring_user_targets ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # verify the required parameter 'patch_flags_request' is set
  if @api_client.config.client_side_validation && patch_flags_request.nil?
    fail ArgumentError, "Missing the required parameter 'patch_flags_request' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(patch_flags_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ExpiringUserTargetPatchResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.patch_expiring_user_targets",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#patch_expiring_user_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_feature_flag(project_key, feature_flag_key, patch_with_comment, opts = {}) ⇒ FeatureFlag

Update feature flag Perform a partial update to a feature flag. The request body must be a valid semantic patch or JSON patch. ### Using semantic patches on a feature flag 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](/reference#updates-using-semantic-patch). The body of a semantic patch request for updating feature flags requires an `environmentKey` in addition to `instructions` and an optional `comment`. The body of the request takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required) The key of the LaunchDarkly environment. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. The body of a single semantic patch can contain many different instructions. ### Instructions Semantic patch requests support the following `kind` instructions for updating feature flags. <details> <summary>Click to expand instructions for turning flags on and off</summary> #### turnFlagOff Sets the flag’s targeting state to Off. Use this request body: “‘json { "environmentKey": "example-environment-key", "instructions": [ { "kind": "turnFlagOff" } ] } “` #### turnFlagOn Sets the flag’s targeting state to On. Use this request body: “‘json { "environmentKey": "example-environment-key", "instructions": [ { "kind": "turnFlagOn" } ] } “` </details><br /> <details> <summary>Click to expand instructions for working with targeting and variations</summary> Several of the instructions for working with targeting and variations require flag rule IDs, variation IDs, or clause IDs as parameters. Each of these are returned as part of the [Get feature flag](/tag/Feature-flags#operation/getFeatureFlag) response. The flag rule ID is the `_id` field of each element in the `rules` array within each environment listed in the `environments` object. The variation ID is the `_id` field in each element of the `variations` array. The clause ID is the `_id` field of each element of the `clauses` array within the `rules` array within each environment listed in the `environments` object. #### addClauses Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "addClauses", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauses": [{ "contextKind": "user", "attribute": "country", "op": "in", "negate": false, "values": ["USA", "Canada"] }] }] } “` #### addPrerequisite Adds the flag indicated by `key` with variation `variationId` as a prerequisite to the flag in the path parameter. ##### Parameters - `key`: Flag key of the prerequisite flag. - `variationId`: ID of a variation of the prerequisite flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "addPrerequisite", "key": "example-prereq-flag-key", "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" }] } “` #### addRule Adds a new targeting rule to the flag. The rule may contain `clauses` and serve the variation that `variationId` indicates, or serve a percentage rollout that `rolloutWeights`, `rolloutBucketBy`, and `rolloutContextKind` indicate. If you set `beforeRuleId`, this adds the new rule before the indicated rule. Otherwise, adds the new rule to the end of the list. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. - `beforeRuleId`: (Optional) ID of a flag rule. - `variationId`: ID of a variation of the flag. - `rolloutWeights`: (Optional) Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "addRule", "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00", "clauses": [{ "contextKind": "organization", "attribute": "located_in", "op": "in", "negate": false, "values": ["Sweden", "Norway"] }] }] } “` #### addTargets Adds context keys to the individual context targets for the context kind that `contextKind` specifies and the variation that `variationId` specifies. Returns an error if this causes the flag to target the same context key in multiple variations. ##### Parameters - `values`: List of context keys. - `contextKind`: (Optional) Context kind to target, defaults to `user` - `variationId`: ID of a variation on the flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "addTargets", "values": ["context-key-123abc", "context-key-456def"], "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" }] } “` #### addUserTargets Adds user keys to the individual user targets for the variation that `variationId` specifies. Returns an error if this causes the flag to target the same user key in multiple variations. ##### Parameters - `values`: List of user keys. - `variationId`: ID of a variation on the flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "addUserTargets", "values": ["user-key-123abc", "user-key-456def"], "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" }] } “` #### addValuesToClause Adds `values` to the values of the clause that `ruleId` and `clauseId` indicate. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "addValuesToClause", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseId": "10a58772-3121-400f-846b-b8a04e8944ed", "values": ["beta_testers"] }] } “` #### clearTargets Removes all individual targets from the variation that `variationId` specifies. This includes both user and non-user targets. ##### Parameters - `variationId`: ID of a variation on the flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "clearTargets", "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" } ] } “` #### clearUserTargets Removes all individual user targets from the variation that `variationId` specifies. ##### Parameters - `variationId`: ID of a variation on the flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "clearUserTargets", "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" } ] } “` #### removeClauses Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseIds`: Array of IDs of clauses in the rule. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "removeClauses", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseIds": ["10a58772-3121-400f-846b-b8a04e8944ed", "36a461dc-235e-4b08-97b9-73ce9365873e"] }] } “` #### removePrerequisite Removes the prerequisite flag indicated by `key`. Does nothing if this prerequisite does not exist. ##### Parameters - `key`: Flag key of an existing prerequisite flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "removePrerequisite", "key": "prereq-flag-key-123abc" } ] } “` #### removeRule Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "removeRule", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" } ] } “` #### removeTargets Removes context keys from the individual context targets for the context kind that `contextKind` specifies and the variation that `variationId` specifies. Does nothing if the flag does not target the context keys. ##### Parameters - `values`: List of context keys. - `contextKind`: (Optional) Context kind to target, defaults to `user` - `variationId`: ID of a flag variation. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "removeTargets", "values": ["context-key-123abc", "context-key-456def"], "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" }] } “` #### removeUserTargets Removes user keys from the individual user targets for the variation that `variationId` specifies. Does nothing if the flag does not target the user keys. ##### Parameters - `values`: List of user keys. - `variationId`: ID of a flag variation. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "removeUserTargets", "values": ["user-key-123abc", "user-key-456def"], "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" }] } “` #### removeValuesFromClause Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "removeValuesFromClause", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseId": "10a58772-3121-400f-846b-b8a04e8944ed", "values": ["beta_testers"] }] } “` #### reorderRules Rearranges the rules to match the order given in `ruleIds`. Returns an error if `ruleIds` does not match the current set of rules on the flag. ##### Parameters - `ruleIds`: Array of IDs of all rules in the flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "reorderRules", "ruleIds": ["a902ef4a-2faf-4eaf-88e1-ecc356708a29", "63c238d1-835d-435e-8f21-c8d5e40b2a3d"] }] } “` #### replacePrerequisites Removes all existing prerequisites and replaces them with the list you provide. ##### Parameters - `prerequisites`: A list of prerequisites. Each item in the list must include a flag `key` and `variationId`. Use this request body: “`json { "environmentKey": "example-environment-key", "instructions": [ { "kind": "replacePrerequisites", "prerequisites": [ { "key": "prereq-flag-key", "variationId": "10a58772-3121-400f-846b-b8a04e8944ed" }, { "key": "another-prereq-flag-key", "variationId": "e5830889-1ec5-4b0c-9cc9-c48790090c43" } ] } ] } “` #### replaceRules Removes all targeting rules for the flag and replaces them with the list you provide. ##### Parameters - `rules`: A list of rules. Use this request body: “`json { "environmentKey": "example-environment-key", "instructions": [ { "kind": "replaceRules", "rules": [ { "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00", "description": "My new rule", "clauses": [ { "contextKind": "user", "attribute": "segmentMatch", "op": "segmentMatch", "values": ["test"] } ], "trackEvents": true } ] } ] } “` #### replaceTargets Removes all existing targeting and replaces it with the list of targets you provide. ##### Parameters - `targets`: A list of context targeting. Each item in the list includes an optional `contextKind` that defaults to `user`, a required `variationId`, and a required list of `values`. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "replaceTargets", "targets": [ { "contextKind": "user", "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00", "values": ["user-key-123abc"] }, { "contextKind": "device", "variationId": "e5830889-1ec5-4b0c-9cc9-c48790090c43", "values": ["device-key-456def"] } ] } ] } “` #### replaceUserTargets Removes all existing user targeting and replaces it with the list of targets you provide. In the list of targets, you must include a target for each of the flag’s variations. ##### Parameters - ‘targets`: A list of user targeting. Each item in the list must include a `variationId` and a list of `values`. Use this request body: “`json { "environmentKey": "example-environment-key", "instructions": [ { "kind": "replaceUserTargets", "targets": [ { "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00", "values": ["user-key-123abc", "user-key-456def"] }, { "variationId": "e5830889-1ec5-4b0c-9cc9-c48790090c43", "values": ["user-key-789ghi"] } ] } ] } “` #### updateClause Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `clause`: New `clause` object, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "updateClause", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseId": "10c7462a-2062-45ba-a8bb-dfb3de0f8af5", "clause": { "contextKind": "user", "attribute": "country", "op": "in", "negate": false, "values": ["Mexico", "Canada"] } }] } “` #### updateFallthroughVariationOrRollout Updates the default or "fallthrough" rule for the flag, which the flag serves when a context matches none of the targeting rules. The rule can serve either the variation that `variationId` indicates, or a percent rollout that `rolloutWeights` and `rolloutBucketBy` indicate. ##### Parameters - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "updateFallthroughVariationOrRollout", "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" }] } “` #### updateOffVariation Updates the default off variation to `variationId`. The flag serves the default off variation when the flag’s targeting is Off. ##### Parameters - ‘variationId`: ID of a variation of the flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "updateOffVariation", "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" } ] } “` #### updatePrerequisite Changes the prerequisite flag that `key` indicates to use the variation that `variationId` indicates. Returns an error if this prerequisite does not exist. ##### Parameters - `key`: Flag key of an existing prerequisite flag. - `variationId`: ID of a variation of the prerequisite flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "updatePrerequisite", "key": "example-prereq-flag-key", "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" }] } “` #### updateRuleDescription Updates the description of the feature flag rule. ##### Parameters - `description`: The new human-readable description for this rule. - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the flag. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "updateRuleDescription", "description": "New rule description", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" }] } “` #### updateRuleTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag associated with this rule. ##### Parameters - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the flag. - `trackEvents`: Whether or not events are tracked. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "updateRuleTrackEvents", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "trackEvents": true }] } “` #### updateRuleVariationOrRollout Updates what `ruleId` serves when its clauses evaluate to true. The rule can serve either the variation that `variationId` indicates, or a percent rollout that `rolloutWeights` and `rolloutBucketBy` indicate. ##### Parameters - `ruleId`: ID of a rule in the flag. - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "updateRuleVariationOrRollout", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "variationId": "2f43f67c-3e4e-4945-a18a-26559378ca00" }] } “` #### updateTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag, for all rules. ##### Parameters - `trackEvents`: Whether or not events are tracked. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "updateTrackEvents", "trackEvents": true } ] } “` #### updateTrackEventsFallthrough Updates whether or not LaunchDarkly tracks events for the feature flag, for the default rule. ##### Parameters - `trackEvents`: Whether or not events are tracked. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "updateTrackEventsFallthrough", "trackEvents": true } ] } “` </details><br /> <details> <summary>Click to expand instructions for updating flag settings</summary> #### addCustomProperties Adds a new custom property to the feature flag. Custom properties are used to associate feature flags with LaunchDarkly integrations. For example, if you create an integration with an issue tracking service, you may want to associate a flag with a list of issues related to a feature’s development. ##### Parameters - ‘key`: The custom property key. - `name`: The custom property name. - `values`: A list of the associated values for the custom property. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "addCustomProperties", "key": "example-custom-property", "name": "Example custom property", "values": ["value1", "value2"] }] } “` #### addTags Adds tags to the feature flag. ##### Parameters - `values`: A list of tags to add. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "addTags", "values": ["tag1", "tag2"] } ] } “` #### makeFlagPermanent Marks the feature flag as permanent. LaunchDarkly does not prompt you to remove permanent flags, even if one variation is rolled out to all your customers. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "makeFlagPermanent" } ] } “` #### makeFlagTemporary Marks the feature flag as temporary. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "makeFlagTemporary" } ] } “` #### removeCustomProperties Removes the associated values from a custom property. If all the associated values are removed, this instruction also removes the custom property. ##### Parameters - `key`: The custom property key. - `values`: A list of the associated values to remove from the custom property. “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "replaceCustomProperties", "key": "example-custom-property", "values": ["value1", "value2"] }] } “` #### removeMaintainer Removes the flag’s maintainer. To set a new maintainer, use the flag’s Settings tab in the LaunchDarkly user interface. Use this request body: “‘json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "removeMaintainer" } ] } “` #### removeTags Removes tags from the feature flag. ##### Parameters - `values`: A list of tags to remove. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "removeTags", "values": ["tag1", "tag2"] } ] } “` #### replaceCustomProperties Replaces the existing associated values for a custom property with the new values. ##### Parameters - `key`: The custom property key. - `name`: The custom property name. - `values`: A list of the new associated values for the custom property. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [{ "kind": "replaceCustomProperties", "key": "example-custom-property", "name": "Example custom property", "values": ["value1", "value2"] }] } “` #### turnOffClientSideAvailability Turns off client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you’re using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - ‘value`: Use "usingMobileKey" to turn off availability for mobile SDKs. Use "usingEnvironmentId" to turn on availability for client-side SDKs. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "turnOffClientSideAvailability", "value": "usingMobileKey" } ] } “` #### turnOnClientSideAvailability Turns on client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you’re using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - ‘value`: Use "usingMobileKey" to turn on availability for mobile SDKs. Use "usingEnvironmentId" to turn on availability for client-side SDKs. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "turnOnClientSideAvailability", "value": "usingMobileKey" } ] } “` #### updateDescription Updates the feature flag description. ##### Parameters - `value`: The new description. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "updateDescription", "value": "Updated flag description" } ] } “` #### updateMaintainerMember Updates the maintainer of the flag to an existing member and removes the existing maintainer. ##### Parameters - `value`: The ID of the member. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "updateMaintainerMember", "value": "61e9b714fd47591727db558a" } ] } “` #### updateMaintainerTeam Updates the maintainer of the flag to an existing team and removes the existing maintainer. ##### Parameters - `value`: The key of the team. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "updateMaintainerTeam", "value": "example-team-key" } ] } “` #### updateName Updates the feature flag name. ##### Parameters - `value`: The new name. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "updateName", "value": "Updated flag name" } ] } “` </details><br /> <details> <summary>Click to expand instructions for updating the flag lifecycle</summary> #### archiveFlag Archives the feature flag. This retires it from LaunchDarkly without deleting it. You cannot archive a flag that is a prerequisite of other flags. “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "archiveFlag" } ] } “` #### deleteFlag Deletes the feature flag and its rules. You cannot restore a deleted flag. If this flag is requested again, the flag value defined in code will be returned for all contexts. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "deleteFlag" } ] } “` #### restoreFlag Restores the feature flag if it was previously archived. Use this request body: “`json { "environmentKey": "environment-key-123abc", "instructions": [ { "kind": "restoreFlag" } ] } “` </details> ### Using JSON Patches on a feature flag If you do not include the header described above, you can use [JSON patch](/reference#updates-using-json-patch). When using the update feature flag endpoint to add individual targets to a specific variation, there are two different patch documents, depending on whether there are already individual targets for the variation. If a flag variation already has individual targets, the path for the JSON Patch operation is: “`json { "op": "add", "path": "/environments/devint/targets/0/values/-", "value": "TestClient10" } “` If a flag variation does not already have individual targets, the path for the JSON Patch operation is: “`json [ { "op": "add", "path": "/environments/devint/targets/-", "value": { "variation": 0, "values": ["TestClient10"] } } ] “` ### Required approvals If a request attempts to alter a flag configuration in an environment where approvals are required for the flag, the request will fail with a 405. Changes to the flag configuration in that environment will require creating an [approval request](/tag/Approvals) or a [workflow](/tag/Workflows-(beta)). ### Conflicts If a flag configuration change made through this endpoint would cause a pending scheduled change or approval request to fail, this endpoint will return a 400. You can ignore this check by adding an `ignoreConflicts` query parameter set to `true`.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key. The key identifies the flag in your code.

  • patch_with_comment (PatchWithComment)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



878
879
880
881
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 878

def patch_feature_flag(project_key, feature_flag_key, patch_with_comment, opts = {})
  data, _status_code, _headers = patch_feature_flag_with_http_info(project_key, feature_flag_key, patch_with_comment, opts)
  data
end

#patch_feature_flag_with_http_info(project_key, feature_flag_key, patch_with_comment, opts = {}) ⇒ Array<(FeatureFlag, Integer, Hash)>

Update feature flag Perform a partial update to a feature flag. The request body must be a valid semantic patch or JSON patch. ### Using semantic patches on a feature flag To make a semantic patch request, you must append &#x60;domain-model&#x3D;launchdarkly.semanticpatch&#x60; to your &#x60;Content-Type&#x60; header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). The body of a semantic patch request for updating feature flags requires an &#x60;environmentKey&#x60; in addition to &#x60;instructions&#x60; and an optional &#x60;comment&#x60;. The body of the request takes the following properties: * &#x60;comment&#x60; (string): (Optional) A description of the update. * &#x60;environmentKey&#x60; (string): (Required) The key of the LaunchDarkly environment. * &#x60;instructions&#x60; (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a &#x60;kind&#x60; property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. The body of a single semantic patch can contain many different instructions. ### Instructions Semantic patch requests support the following &#x60;kind&#x60; instructions for updating feature flags. &lt;details&gt; &lt;summary&gt;Click to expand instructions for turning flags on and off&lt;/summary&gt; #### turnFlagOff Sets the flag&#39;s targeting state to Off. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;example-environment-key&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;turnFlagOff&quot; } ] } &#x60;&#x60;&#x60; #### turnFlagOn Sets the flag&#39;s targeting state to On. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;example-environment-key&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;turnFlagOn&quot; } ] } &#x60;&#x60;&#x60; &lt;/details&gt;&lt;br /&gt; &lt;details&gt; &lt;summary&gt;Click to expand instructions for working with targeting and variations&lt;/summary&gt; Several of the instructions for working with targeting and variations require flag rule IDs, variation IDs, or clause IDs as parameters. Each of these are returned as part of the [Get feature flag](/tag/Feature-flags#operation/getFeatureFlag) response. The flag rule ID is the &#x60;_id&#x60; field of each element in the &#x60;rules&#x60; array within each environment listed in the &#x60;environments&#x60; object. The variation ID is the &#x60;_id&#x60; field in each element of the &#x60;variations&#x60; array. The clause ID is the &#x60;_id&#x60; field of each element of the &#x60;clauses&#x60; array within the &#x60;rules&#x60; array within each environment listed in the &#x60;environments&#x60; object. #### addClauses Adds the given clauses to the rule indicated by &#x60;ruleId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag. - &#x60;clauses&#x60;: Array of clause objects, with &#x60;contextKind&#x60; (string), &#x60;attribute&#x60; (string), &#x60;op&#x60; (string), &#x60;negate&#x60; (boolean), and &#x60;values&#x60; (array of strings, numbers, or dates) properties. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;addClauses&quot;, &quot;ruleId&quot;: &quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot;, &quot;clauses&quot;: [{ &quot;contextKind&quot;: &quot;user&quot;, &quot;attribute&quot;: &quot;country&quot;, &quot;op&quot;: &quot;in&quot;, &quot;negate&quot;: false, &quot;values&quot;: [&quot;USA&quot;, &quot;Canada&quot;] }] }] } &#x60;&#x60;&#x60; #### addPrerequisite Adds the flag indicated by &#x60;key&#x60; with variation &#x60;variationId&#x60; as a prerequisite to the flag in the path parameter. ##### Parameters - &#x60;key&#x60;: Flag key of the prerequisite flag. - &#x60;variationId&#x60;: ID of a variation of the prerequisite flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;addPrerequisite&quot;, &quot;key&quot;: &quot;example-prereq-flag-key&quot;, &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; }] } &#x60;&#x60;&#x60; #### addRule Adds a new targeting rule to the flag. The rule may contain &#x60;clauses&#x60; and serve the variation that &#x60;variationId&#x60; indicates, or serve a percentage rollout that &#x60;rolloutWeights&#x60;, &#x60;rolloutBucketBy&#x60;, and &#x60;rolloutContextKind&#x60; indicate. If you set &#x60;beforeRuleId&#x60;, this adds the new rule before the indicated rule. Otherwise, adds the new rule to the end of the list. ##### Parameters - &#x60;clauses&#x60;: Array of clause objects, with &#x60;contextKind&#x60; (string), &#x60;attribute&#x60; (string), &#x60;op&#x60; (string), &#x60;negate&#x60; (boolean), and &#x60;values&#x60; (array of strings, numbers, or dates) properties. - &#x60;beforeRuleId&#x60;: (Optional) ID of a flag rule. - &#x60;variationId&#x60;: ID of a variation of the flag. - &#x60;rolloutWeights&#x60;: (Optional) Map of &#x60;variationId&#x60; to weight, in thousandths of a percent (0-100000). - &#x60;rolloutBucketBy&#x60;: (Optional) Context attribute available in the specified &#x60;rolloutContextKind&#x60;. - &#x60;rolloutContextKind&#x60;: (Optional) Context kind, defaults to &#x60;user&#x60; Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;addRule&quot;, &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot;, &quot;clauses&quot;: [{ &quot;contextKind&quot;: &quot;organization&quot;, &quot;attribute&quot;: &quot;located_in&quot;, &quot;op&quot;: &quot;in&quot;, &quot;negate&quot;: false, &quot;values&quot;: [&quot;Sweden&quot;, &quot;Norway&quot;] }] }] } &#x60;&#x60;&#x60; #### addTargets Adds context keys to the individual context targets for the context kind that &#x60;contextKind&#x60; specifies and the variation that &#x60;variationId&#x60; specifies. Returns an error if this causes the flag to target the same context key in multiple variations. ##### Parameters - &#x60;values&#x60;: List of context keys. - &#x60;contextKind&#x60;: (Optional) Context kind to target, defaults to &#x60;user&#x60; - &#x60;variationId&#x60;: ID of a variation on the flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;addTargets&quot;, &quot;values&quot;: [&quot;context-key-123abc&quot;, &quot;context-key-456def&quot;], &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; }] } &#x60;&#x60;&#x60; #### addUserTargets Adds user keys to the individual user targets for the variation that &#x60;variationId&#x60; specifies. Returns an error if this causes the flag to target the same user key in multiple variations. ##### Parameters - &#x60;values&#x60;: List of user keys. - &#x60;variationId&#x60;: ID of a variation on the flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;addUserTargets&quot;, &quot;values&quot;: [&quot;user-key-123abc&quot;, &quot;user-key-456def&quot;], &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; }] } &#x60;&#x60;&#x60; #### addValuesToClause Adds &#x60;values&#x60; to the values of the clause that &#x60;ruleId&#x60; and &#x60;clauseId&#x60; indicate. Does not update the context kind, attribute, or operator. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag. - &#x60;clauseId&#x60;: ID of a clause in that rule. - &#x60;values&#x60;: Array of strings. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;addValuesToClause&quot;, &quot;ruleId&quot;: &quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot;, &quot;clauseId&quot;: &quot;10a58772-3121-400f-846b-b8a04e8944ed&quot;, &quot;values&quot;: [&quot;beta_testers&quot;] }] } &#x60;&#x60;&#x60; #### clearTargets Removes all individual targets from the variation that &#x60;variationId&#x60; specifies. This includes both user and non-user targets. ##### Parameters - &#x60;variationId&#x60;: ID of a variation on the flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;clearTargets&quot;, &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; } ] } &#x60;&#x60;&#x60; #### clearUserTargets Removes all individual user targets from the variation that &#x60;variationId&#x60; specifies. ##### Parameters - &#x60;variationId&#x60;: ID of a variation on the flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;clearUserTargets&quot;, &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; } ] } &#x60;&#x60;&#x60; #### removeClauses Removes the clauses specified by &#x60;clauseIds&#x60; from the rule indicated by &#x60;ruleId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag. - &#x60;clauseIds&#x60;: Array of IDs of clauses in the rule. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;removeClauses&quot;, &quot;ruleId&quot;: &quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot;, &quot;clauseIds&quot;: [&quot;10a58772-3121-400f-846b-b8a04e8944ed&quot;, &quot;36a461dc-235e-4b08-97b9-73ce9365873e&quot;] }] } &#x60;&#x60;&#x60; #### removePrerequisite Removes the prerequisite flag indicated by &#x60;key&#x60;. Does nothing if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: Flag key of an existing prerequisite flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;removePrerequisite&quot;, &quot;key&quot;: &quot;prereq-flag-key-123abc&quot; } ] } &#x60;&#x60;&#x60; #### removeRule Removes the targeting rule specified by &#x60;ruleId&#x60;. Does nothing if the rule does not exist. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;removeRule&quot;, &quot;ruleId&quot;: &quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot; } ] } &#x60;&#x60;&#x60; #### removeTargets Removes context keys from the individual context targets for the context kind that &#x60;contextKind&#x60; specifies and the variation that &#x60;variationId&#x60; specifies. Does nothing if the flag does not target the context keys. ##### Parameters - &#x60;values&#x60;: List of context keys. - &#x60;contextKind&#x60;: (Optional) Context kind to target, defaults to &#x60;user&#x60; - &#x60;variationId&#x60;: ID of a flag variation. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;removeTargets&quot;, &quot;values&quot;: [&quot;context-key-123abc&quot;, &quot;context-key-456def&quot;], &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; }] } &#x60;&#x60;&#x60; #### removeUserTargets Removes user keys from the individual user targets for the variation that &#x60;variationId&#x60; specifies. Does nothing if the flag does not target the user keys. ##### Parameters - &#x60;values&#x60;: List of user keys. - &#x60;variationId&#x60;: ID of a flag variation. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;removeUserTargets&quot;, &quot;values&quot;: [&quot;user-key-123abc&quot;, &quot;user-key-456def&quot;], &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; }] } &#x60;&#x60;&#x60; #### removeValuesFromClause Removes &#x60;values&#x60; from the values of the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60;. Does not update the context kind, attribute, or operator. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag. - &#x60;clauseId&#x60;: ID of a clause in that rule. - &#x60;values&#x60;: Array of strings. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;removeValuesFromClause&quot;, &quot;ruleId&quot;: &quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot;, &quot;clauseId&quot;: &quot;10a58772-3121-400f-846b-b8a04e8944ed&quot;, &quot;values&quot;: [&quot;beta_testers&quot;] }] } &#x60;&#x60;&#x60; #### reorderRules Rearranges the rules to match the order given in &#x60;ruleIds&#x60;. Returns an error if &#x60;ruleIds&#x60; does not match the current set of rules on the flag. ##### Parameters - &#x60;ruleIds&#x60;: Array of IDs of all rules in the flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;reorderRules&quot;, &quot;ruleIds&quot;: [&quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot;, &quot;63c238d1-835d-435e-8f21-c8d5e40b2a3d&quot;] }] } &#x60;&#x60;&#x60; #### replacePrerequisites Removes all existing prerequisites and replaces them with the list you provide. ##### Parameters - &#x60;prerequisites&#x60;: A list of prerequisites. Each item in the list must include a flag &#x60;key&#x60; and &#x60;variationId&#x60;. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;example-environment-key&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;replacePrerequisites&quot;, &quot;prerequisites&quot;: [ { &quot;key&quot;: &quot;prereq-flag-key&quot;, &quot;variationId&quot;: &quot;10a58772-3121-400f-846b-b8a04e8944ed&quot; }, { &quot;key&quot;: &quot;another-prereq-flag-key&quot;, &quot;variationId&quot;: &quot;e5830889-1ec5-4b0c-9cc9-c48790090c43&quot; } ] } ] } &#x60;&#x60;&#x60; #### replaceRules Removes all targeting rules for the flag and replaces them with the list you provide. ##### Parameters - &#x60;rules&#x60;: A list of rules. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;example-environment-key&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;replaceRules&quot;, &quot;rules&quot;: [ { &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot;, &quot;description&quot;: &quot;My new rule&quot;, &quot;clauses&quot;: [ { &quot;contextKind&quot;: &quot;user&quot;, &quot;attribute&quot;: &quot;segmentMatch&quot;, &quot;op&quot;: &quot;segmentMatch&quot;, &quot;values&quot;: [&quot;test&quot;] } ], &quot;trackEvents&quot;: true } ] } ] } &#x60;&#x60;&#x60; #### replaceTargets Removes all existing targeting and replaces it with the list of targets you provide. ##### Parameters - &#x60;targets&#x60;: A list of context targeting. Each item in the list includes an optional &#x60;contextKind&#x60; that defaults to &#x60;user&#x60;, a required &#x60;variationId&#x60;, and a required list of &#x60;values&#x60;. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;replaceTargets&quot;, &quot;targets&quot;: [ { &quot;contextKind&quot;: &quot;user&quot;, &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot;, &quot;values&quot;: [&quot;user-key-123abc&quot;] }, { &quot;contextKind&quot;: &quot;device&quot;, &quot;variationId&quot;: &quot;e5830889-1ec5-4b0c-9cc9-c48790090c43&quot;, &quot;values&quot;: [&quot;device-key-456def&quot;] } ] } ] } &#x60;&#x60;&#x60; #### replaceUserTargets Removes all existing user targeting and replaces it with the list of targets you provide. In the list of targets, you must include a target for each of the flag&#39;s variations. ##### Parameters - &#x60;targets&#x60;: A list of user targeting. Each item in the list must include a &#x60;variationId&#x60; and a list of &#x60;values&#x60;. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;example-environment-key&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;replaceUserTargets&quot;, &quot;targets&quot;: [ { &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot;, &quot;values&quot;: [&quot;user-key-123abc&quot;, &quot;user-key-456def&quot;] }, { &quot;variationId&quot;: &quot;e5830889-1ec5-4b0c-9cc9-c48790090c43&quot;, &quot;values&quot;: [&quot;user-key-789ghi&quot;] } ] } ] } &#x60;&#x60;&#x60; #### updateClause Replaces the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60; with &#x60;clause&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag. - &#x60;clauseId&#x60;: ID of a clause in that rule. - &#x60;clause&#x60;: New &#x60;clause&#x60; object, with &#x60;contextKind&#x60; (string), &#x60;attribute&#x60; (string), &#x60;op&#x60; (string), &#x60;negate&#x60; (boolean), and &#x60;values&#x60; (array of strings, numbers, or dates) properties. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateClause&quot;, &quot;ruleId&quot;: &quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot;, &quot;clauseId&quot;: &quot;10c7462a-2062-45ba-a8bb-dfb3de0f8af5&quot;, &quot;clause&quot;: { &quot;contextKind&quot;: &quot;user&quot;, &quot;attribute&quot;: &quot;country&quot;, &quot;op&quot;: &quot;in&quot;, &quot;negate&quot;: false, &quot;values&quot;: [&quot;Mexico&quot;, &quot;Canada&quot;] } }] } &#x60;&#x60;&#x60; #### updateFallthroughVariationOrRollout Updates the default or &quot;fallthrough&quot; rule for the flag, which the flag serves when a context matches none of the targeting rules. The rule can serve either the variation that &#x60;variationId&#x60; indicates, or a percent rollout that &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60; indicate. ##### Parameters - &#x60;variationId&#x60;: ID of a variation of the flag. or - &#x60;rolloutWeights&#x60;: Map of &#x60;variationId&#x60; to weight, in thousandths of a percent (0-100000). - &#x60;rolloutBucketBy&#x60;: (Optional) Context attribute available in the specified &#x60;rolloutContextKind&#x60;. - &#x60;rolloutContextKind&#x60;: (Optional) Context kind, defaults to &#x60;user&#x60; Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateFallthroughVariationOrRollout&quot;, &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; }] } &#x60;&#x60;&#x60; #### updateOffVariation Updates the default off variation to &#x60;variationId&#x60;. The flag serves the default off variation when the flag&#39;s targeting is Off. ##### Parameters - &#x60;variationId&#x60;: ID of a variation of the flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;updateOffVariation&quot;, &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; } ] } &#x60;&#x60;&#x60; #### updatePrerequisite Changes the prerequisite flag that &#x60;key&#x60; indicates to use the variation that &#x60;variationId&#x60; indicates. Returns an error if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: Flag key of an existing prerequisite flag. - &#x60;variationId&#x60;: ID of a variation of the prerequisite flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updatePrerequisite&quot;, &quot;key&quot;: &quot;example-prereq-flag-key&quot;, &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; }] } &#x60;&#x60;&#x60; #### updateRuleDescription Updates the description of the feature flag rule. ##### Parameters - &#x60;description&#x60;: The new human-readable description for this rule. - &#x60;ruleId&#x60;: The ID of the rule. You can retrieve this by making a GET request for the flag. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateRuleDescription&quot;, &quot;description&quot;: &quot;New rule description&quot;, &quot;ruleId&quot;: &quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot; }] } &#x60;&#x60;&#x60; #### updateRuleTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag associated with this rule. ##### Parameters - &#x60;ruleId&#x60;: The ID of the rule. You can retrieve this by making a GET request for the flag. - &#x60;trackEvents&#x60;: Whether or not events are tracked. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateRuleTrackEvents&quot;, &quot;ruleId&quot;: &quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot;, &quot;trackEvents&quot;: true }] } &#x60;&#x60;&#x60; #### updateRuleVariationOrRollout Updates what &#x60;ruleId&#x60; serves when its clauses evaluate to true. The rule can serve either the variation that &#x60;variationId&#x60; indicates, or a percent rollout that &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60; indicate. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag. - &#x60;variationId&#x60;: ID of a variation of the flag. or - &#x60;rolloutWeights&#x60;: Map of &#x60;variationId&#x60; to weight, in thousandths of a percent (0-100000). - &#x60;rolloutBucketBy&#x60;: (Optional) Context attribute available in the specified &#x60;rolloutContextKind&#x60;. - &#x60;rolloutContextKind&#x60;: (Optional) Context kind, defaults to &#x60;user&#x60; Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateRuleVariationOrRollout&quot;, &quot;ruleId&quot;: &quot;a902ef4a-2faf-4eaf-88e1-ecc356708a29&quot;, &quot;variationId&quot;: &quot;2f43f67c-3e4e-4945-a18a-26559378ca00&quot; }] } &#x60;&#x60;&#x60; #### updateTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag, for all rules. ##### Parameters - &#x60;trackEvents&#x60;: Whether or not events are tracked. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;updateTrackEvents&quot;, &quot;trackEvents&quot;: true } ] } &#x60;&#x60;&#x60; #### updateTrackEventsFallthrough Updates whether or not LaunchDarkly tracks events for the feature flag, for the default rule. ##### Parameters - &#x60;trackEvents&#x60;: Whether or not events are tracked. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;updateTrackEventsFallthrough&quot;, &quot;trackEvents&quot;: true } ] } &#x60;&#x60;&#x60; &lt;/details&gt;&lt;br /&gt; &lt;details&gt; &lt;summary&gt;Click to expand instructions for updating flag settings&lt;/summary&gt; #### addCustomProperties Adds a new custom property to the feature flag. Custom properties are used to associate feature flags with LaunchDarkly integrations. For example, if you create an integration with an issue tracking service, you may want to associate a flag with a list of issues related to a feature&#39;s development. ##### Parameters - &#x60;key&#x60;: The custom property key. - &#x60;name&#x60;: The custom property name. - &#x60;values&#x60;: A list of the associated values for the custom property. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;addCustomProperties&quot;, &quot;key&quot;: &quot;example-custom-property&quot;, &quot;name&quot;: &quot;Example custom property&quot;, &quot;values&quot;: [&quot;value1&quot;, &quot;value2&quot;] }] } &#x60;&#x60;&#x60; #### addTags Adds tags to the feature flag. ##### Parameters - &#x60;values&#x60;: A list of tags to add. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;addTags&quot;, &quot;values&quot;: [&quot;tag1&quot;, &quot;tag2&quot;] } ] } &#x60;&#x60;&#x60; #### makeFlagPermanent Marks the feature flag as permanent. LaunchDarkly does not prompt you to remove permanent flags, even if one variation is rolled out to all your customers. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;makeFlagPermanent&quot; } ] } &#x60;&#x60;&#x60; #### makeFlagTemporary Marks the feature flag as temporary. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;makeFlagTemporary&quot; } ] } &#x60;&#x60;&#x60; #### removeCustomProperties Removes the associated values from a custom property. If all the associated values are removed, this instruction also removes the custom property. ##### Parameters - &#x60;key&#x60;: The custom property key. - &#x60;values&#x60;: A list of the associated values to remove from the custom property. &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;replaceCustomProperties&quot;, &quot;key&quot;: &quot;example-custom-property&quot;, &quot;values&quot;: [&quot;value1&quot;, &quot;value2&quot;] }] } &#x60;&#x60;&#x60; #### removeMaintainer Removes the flag&#39;s maintainer. To set a new maintainer, use the flag&#39;s Settings tab in the LaunchDarkly user interface. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;removeMaintainer&quot; } ] } &#x60;&#x60;&#x60; #### removeTags Removes tags from the feature flag. ##### Parameters - &#x60;values&#x60;: A list of tags to remove. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;removeTags&quot;, &quot;values&quot;: [&quot;tag1&quot;, &quot;tag2&quot;] } ] } &#x60;&#x60;&#x60; #### replaceCustomProperties Replaces the existing associated values for a custom property with the new values. ##### Parameters - &#x60;key&#x60;: The custom property key. - &#x60;name&#x60;: The custom property name. - &#x60;values&#x60;: A list of the new associated values for the custom property. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;replaceCustomProperties&quot;, &quot;key&quot;: &quot;example-custom-property&quot;, &quot;name&quot;: &quot;Example custom property&quot;, &quot;values&quot;: [&quot;value1&quot;, &quot;value2&quot;] }] } &#x60;&#x60;&#x60; #### turnOffClientSideAvailability Turns off client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you&#39;re using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - &#x60;value&#x60;: Use &quot;usingMobileKey&quot; to turn off availability for mobile SDKs. Use &quot;usingEnvironmentId&quot; to turn on availability for client-side SDKs. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;turnOffClientSideAvailability&quot;, &quot;value&quot;: &quot;usingMobileKey&quot; } ] } &#x60;&#x60;&#x60; #### turnOnClientSideAvailability Turns on client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you&#39;re using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - &#x60;value&#x60;: Use &quot;usingMobileKey&quot; to turn on availability for mobile SDKs. Use &quot;usingEnvironmentId&quot; to turn on availability for client-side SDKs. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;turnOnClientSideAvailability&quot;, &quot;value&quot;: &quot;usingMobileKey&quot; } ] } &#x60;&#x60;&#x60; #### updateDescription Updates the feature flag description. ##### Parameters - &#x60;value&#x60;: The new description. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;updateDescription&quot;, &quot;value&quot;: &quot;Updated flag description&quot; } ] } &#x60;&#x60;&#x60; #### updateMaintainerMember Updates the maintainer of the flag to an existing member and removes the existing maintainer. ##### Parameters - &#x60;value&#x60;: The ID of the member. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;updateMaintainerMember&quot;, &quot;value&quot;: &quot;61e9b714fd47591727db558a&quot; } ] } &#x60;&#x60;&#x60; #### updateMaintainerTeam Updates the maintainer of the flag to an existing team and removes the existing maintainer. ##### Parameters - &#x60;value&#x60;: The key of the team. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;updateMaintainerTeam&quot;, &quot;value&quot;: &quot;example-team-key&quot; } ] } &#x60;&#x60;&#x60; #### updateName Updates the feature flag name. ##### Parameters - &#x60;value&#x60;: The new name. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;updateName&quot;, &quot;value&quot;: &quot;Updated flag name&quot; } ] } &#x60;&#x60;&#x60; &lt;/details&gt;&lt;br /&gt; &lt;details&gt; &lt;summary&gt;Click to expand instructions for updating the flag lifecycle&lt;/summary&gt; #### archiveFlag Archives the feature flag. This retires it from LaunchDarkly without deleting it. You cannot archive a flag that is a prerequisite of other flags. &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;archiveFlag&quot; } ] } &#x60;&#x60;&#x60; #### deleteFlag Deletes the feature flag and its rules. You cannot restore a deleted flag. If this flag is requested again, the flag value defined in code will be returned for all contexts. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;deleteFlag&quot; } ] } &#x60;&#x60;&#x60; #### restoreFlag Restores the feature flag if it was previously archived. Use this request body: &#x60;&#x60;&#x60;json { &quot;environmentKey&quot;: &quot;environment-key-123abc&quot;, &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;restoreFlag&quot; } ] } &#x60;&#x60;&#x60; &lt;/details&gt; ### Using JSON Patches on a feature flag If you do not include the header described above, you can use [JSON patch](/reference#updates-using-json-patch). When using the update feature flag endpoint to add individual targets to a specific variation, there are two different patch documents, depending on whether there are already individual targets for the variation. If a flag variation already has individual targets, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json { &quot;op&quot;: &quot;add&quot;, &quot;path&quot;: &quot;/environments/devint/targets/0/values/-&quot;, &quot;value&quot;: &quot;TestClient10&quot; } &#x60;&#x60;&#x60; If a flag variation does not already have individual targets, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json [ { &quot;op&quot;: &quot;add&quot;, &quot;path&quot;: &quot;/environments/devint/targets/-&quot;, &quot;value&quot;: { &quot;variation&quot;: 0, &quot;values&quot;: [&quot;TestClient10&quot;] } } ] &#x60;&#x60;&#x60; ### Required approvals If a request attempts to alter a flag configuration in an environment where approvals are required for the flag, the request will fail with a 405. Changes to the flag configuration in that environment will require creating an [approval request](/tag/Approvals) or a [workflow](/tag/Workflows-(beta)). ### Conflicts If a flag configuration change made through this endpoint would cause a pending scheduled change or approval request to fail, this endpoint will return a 400. You can ignore this check by adding an &#x60;ignoreConflicts&#x60; query parameter set to &#x60;true&#x60;.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key. The key identifies the flag in your code.

  • patch_with_comment (PatchWithComment)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FeatureFlag, Integer, Hash)>)

    FeatureFlag data, response status code and response headers



890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 890

def patch_feature_flag_with_http_info(project_key, feature_flag_key, patch_with_comment, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.patch_feature_flag ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.patch_feature_flag"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.patch_feature_flag"
  end
  # verify the required parameter 'patch_with_comment' is set
  if @api_client.config.client_side_validation && patch_with_comment.nil?
    fail ArgumentError, "Missing the required parameter 'patch_with_comment' when calling FeatureFlagsApi.patch_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(patch_with_comment)

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlag'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.patch_feature_flag",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#patch_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_feature_flag(project_key, feature_flag_body, opts = {}) ⇒ FeatureFlag

Create a feature flag Create a feature flag with the given name, key, and variations.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_body (FeatureFlagBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :clone (String)

    The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting &#x60;clone&#x3D;flagKey&#x60; copies the full targeting configuration for all environments, including &#x60;on/off&#x60; state, from the original flag to the new flag.

Returns:



958
959
960
961
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 958

def post_feature_flag(project_key, feature_flag_body, opts = {})
  data, _status_code, _headers = post_feature_flag_with_http_info(project_key, feature_flag_body, opts)
  data
end

#post_feature_flag_with_http_info(project_key, feature_flag_body, opts = {}) ⇒ Array<(FeatureFlag, Integer, Hash)>

Create a feature flag Create a feature flag with the given name, key, and variations.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_body (FeatureFlagBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :clone (String)

    The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting &#x60;clone&#x3D;flagKey&#x60; copies the full targeting configuration for all environments, including &#x60;on/off&#x60; state, from the original flag to the new flag.

Returns:

  • (Array<(FeatureFlag, Integer, Hash)>)

    FeatureFlag data, response status code and response headers



970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 970

def post_feature_flag_with_http_info(project_key, feature_flag_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.post_feature_flag ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.post_feature_flag"
  end
  # verify the required parameter 'feature_flag_body' is set
  if @api_client.config.client_side_validation && feature_flag_body.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_body' when calling FeatureFlagsApi.post_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projectKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'clone'] = opts[:'clone'] if !opts[:'clone'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(feature_flag_body)

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlag'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.post_feature_flag",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#post_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end