launchdarkly_api 6.0.0 → 7.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (605) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +830 -295
  3. data/docs/AccessDeniedReasonRep.md +4 -4
  4. data/docs/AccessTokensApi.md +1 -1
  5. data/docs/AccountMembersApi.md +86 -12
  6. data/docs/ActionInputRep.md +18 -0
  7. data/docs/ActionOutputRep.md +20 -0
  8. data/docs/ApprovalConditionInputRep.md +20 -0
  9. data/docs/ApprovalConditionOutputRep.md +26 -0
  10. data/docs/ApprovalSettings.md +1 -1
  11. data/docs/ApprovalsApi.md +3 -3
  12. data/docs/BranchCollectionRep.md +1 -1
  13. data/docs/BranchRep.md +9 -9
  14. data/docs/CodeReferencesApi.md +37 -32
  15. data/docs/ConditionBaseOutputRep.md +22 -0
  16. data/docs/ConditionInputRep.md +26 -0
  17. data/docs/ConditionOutputRep.md +34 -0
  18. data/docs/ConflictOutputRep.md +20 -0
  19. data/docs/CreateCopyFlagConfigApprovalRequestRequest.md +1 -1
  20. data/docs/CustomRole.md +10 -8
  21. data/docs/CustomRolePost.md +3 -1
  22. data/docs/CustomRolePostData.md +3 -1
  23. data/docs/CustomRolesApi.md +11 -11
  24. data/docs/CustomRolesRep.md +24 -0
  25. data/docs/CustomWorkflowInputRep.md +24 -0
  26. data/docs/CustomWorkflowMeta.md +20 -0
  27. data/docs/CustomWorkflowOutputRep.md +38 -0
  28. data/docs/CustomWorkflowStageMeta.md +20 -0
  29. data/docs/CustomWorkflowsListingOutputRep.md +18 -0
  30. data/docs/DataExportDestinationsApi.md +1 -1
  31. data/docs/DerivedAttribute.md +20 -0
  32. data/docs/Environment.md +4 -0
  33. data/docs/EnvironmentsApi.md +3 -3
  34. data/docs/ExecutionOutputRep.md +18 -0
  35. data/docs/ExpandedTeamRep.md +44 -0
  36. data/docs/ExperimentResultsRep.md +3 -1
  37. data/docs/ExperimentsBetaApi.md +1 -1
  38. data/docs/Extinction.md +8 -8
  39. data/docs/ExtinctionCollectionRep.md +1 -1
  40. data/docs/FeatureFlagBody.md +1 -1
  41. data/docs/FeatureFlagsApi.md +2 -4
  42. data/docs/FlagConfigApprovalRequestResponse.md +3 -1
  43. data/docs/FlagTriggerInput.md +20 -0
  44. data/docs/FlagTriggersApi.md +396 -0
  45. data/docs/ForbiddenErrorRep.md +20 -0
  46. data/docs/HunkRep.md +10 -10
  47. data/docs/Integration.md +40 -0
  48. data/docs/IntegrationAuditLogSubscriptionsApi.md +376 -0
  49. data/docs/IntegrationStatusRep.md +22 -0
  50. data/docs/IntegrationSubscriptionStatusRep.md +26 -0
  51. data/docs/Integrations.md +22 -0
  52. data/docs/InvalidRequestErrorRep.md +20 -0
  53. data/docs/Member.md +3 -1
  54. data/docs/MemberImportItemRep.md +22 -0
  55. data/docs/MemberTeamsPostInput.md +18 -0
  56. data/docs/MethodNotAllowedErrorRep.md +20 -0
  57. data/docs/MetricListingRep.md +1 -1
  58. data/docs/MetricPost.md +1 -1
  59. data/docs/MetricRep.md +1 -1
  60. data/docs/MetricSeen.md +20 -0
  61. data/docs/MetricsApi.md +2 -2
  62. data/docs/NotFoundErrorRep.md +20 -0
  63. data/docs/OtherApi.md +4 -4
  64. data/docs/PatchFailedErrorRep.md +20 -0
  65. data/docs/PermissionGrantInput.md +22 -0
  66. data/docs/PermissionGrantRep.md +24 -0
  67. data/docs/ProjectPost.md +1 -1
  68. data/docs/ProjectsApi.md +2 -2
  69. data/docs/PutBranch.md +28 -0
  70. data/docs/RateLimitedErrorRep.md +20 -0
  71. data/docs/RecentTriggerBody.md +20 -0
  72. data/docs/ReferenceRep.md +5 -5
  73. data/docs/RelayProxyConfigurationsApi.md +2 -2
  74. data/docs/RepositoryCollectionRep.md +1 -1
  75. data/docs/RepositoryPost.md +8 -8
  76. data/docs/RepositoryRep.md +17 -17
  77. data/docs/ReviewOutputRep.md +26 -0
  78. data/docs/Rule.md +3 -1
  79. data/docs/ScheduleConditionInputRep.md +20 -0
  80. data/docs/ScheduleConditionOutputRep.md +18 -0
  81. data/docs/ScheduledChangesApi.md +2 -2
  82. data/docs/SegmentsApi.md +6 -6
  83. data/docs/StageInputRep.md +22 -0
  84. data/docs/StageOutputRep.md +26 -0
  85. data/docs/Statement.md +4 -4
  86. data/docs/StatementRep.md +3 -3
  87. data/docs/StatusConflictErrorRep.md +20 -0
  88. data/docs/SubscriptionPost.md +30 -0
  89. data/docs/TeamCollectionRep.md +22 -0
  90. data/docs/TeamImportsRep.md +18 -0
  91. data/docs/TeamPatchInput.md +20 -0
  92. data/docs/TeamPostInput.md +28 -0
  93. data/docs/TeamRep.md +40 -0
  94. data/docs/TeamsBetaApi.md +450 -0
  95. data/docs/TriggerPost.md +22 -0
  96. data/docs/TriggerWorkflowCollectionRep.md +20 -0
  97. data/docs/TriggerWorkflowRep.md +42 -0
  98. data/docs/UnauthorizedErrorRep.md +20 -0
  99. data/docs/User.md +26 -14
  100. data/docs/UserRecord.md +5 -1
  101. data/docs/UserRecordRep.md +26 -0
  102. data/docs/UserSegment.md +3 -1
  103. data/docs/UserSettingsApi.md +1 -1
  104. data/docs/Users.md +1 -1
  105. data/docs/UsersApi.md +11 -7
  106. data/docs/WebhooksApi.md +1 -1
  107. data/docs/WorkflowsBetaApi.md +316 -0
  108. data/git_push.sh +3 -3
  109. data/launchdarkly_api.gemspec +5 -5
  110. data/lib/launchdarkly_api/api/access_tokens_api.rb +12 -4
  111. data/lib/launchdarkly_api/api/account_members_api.rb +103 -21
  112. data/lib/launchdarkly_api/api/account_usage_beta_api.rb +2 -2
  113. data/lib/launchdarkly_api/api/approvals_api.rb +21 -7
  114. data/lib/launchdarkly_api/api/audit_log_api.rb +2 -2
  115. data/lib/launchdarkly_api/api/code_references_api.rb +66 -35
  116. data/lib/launchdarkly_api/api/custom_roles_api.rb +24 -16
  117. data/lib/launchdarkly_api/api/data_export_destinations_api.rb +12 -4
  118. data/lib/launchdarkly_api/api/environments_api.rb +16 -8
  119. data/lib/launchdarkly_api/api/experiments_beta_api.rb +4 -2
  120. data/lib/launchdarkly_api/api/feature_flags_api.rb +22 -11
  121. data/lib/launchdarkly_api/api/feature_flags_beta_api.rb +2 -2
  122. data/lib/launchdarkly_api/api/flag_triggers_api.rb +437 -0
  123. data/lib/launchdarkly_api/api/integration_audit_log_subscriptions_api.rb +377 -0
  124. data/lib/launchdarkly_api/api/metrics_api.rb +14 -6
  125. data/lib/launchdarkly_api/api/other_api.rb +5 -5
  126. data/lib/launchdarkly_api/api/projects_api.rb +14 -6
  127. data/lib/launchdarkly_api/api/relay_proxy_configurations_api.rb +12 -4
  128. data/lib/launchdarkly_api/api/scheduled_changes_api.rb +14 -6
  129. data/lib/launchdarkly_api/api/segments_api.rb +28 -12
  130. data/lib/launchdarkly_api/api/teams_beta_api.rb +427 -0
  131. data/lib/launchdarkly_api/api/user_settings_api.rb +12 -4
  132. data/lib/launchdarkly_api/api/users_api.rb +15 -7
  133. data/lib/launchdarkly_api/api/users_beta_api.rb +2 -2
  134. data/lib/launchdarkly_api/api/webhooks_api.rb +12 -4
  135. data/lib/launchdarkly_api/api/workflows_beta_api.rb +345 -0
  136. data/lib/launchdarkly_api/api_client.rb +5 -5
  137. data/lib/launchdarkly_api/api_error.rb +2 -2
  138. data/lib/launchdarkly_api/configuration.rb +4 -3
  139. data/lib/launchdarkly_api/models/access_denied_reason_rep.rb +8 -4
  140. data/lib/launchdarkly_api/models/access_denied_rep.rb +2 -2
  141. data/lib/launchdarkly_api/models/access_rep.rb +2 -2
  142. data/lib/launchdarkly_api/models/access_token_post.rb +2 -2
  143. data/lib/launchdarkly_api/models/action_input_rep.rb +219 -0
  144. data/lib/launchdarkly_api/models/action_output_rep.rb +239 -0
  145. data/lib/launchdarkly_api/models/approval_condition_input_rep.rb +229 -0
  146. data/lib/launchdarkly_api/models/approval_condition_output_rep.rb +278 -0
  147. data/lib/launchdarkly_api/models/approval_settings.rb +3 -3
  148. data/lib/launchdarkly_api/models/audit_log_entry_listing_rep.rb +2 -2
  149. data/lib/launchdarkly_api/models/audit_log_entry_listing_rep_collection.rb +2 -2
  150. data/lib/launchdarkly_api/models/audit_log_entry_rep.rb +2 -2
  151. data/lib/launchdarkly_api/models/authorized_app_data_rep.rb +2 -2
  152. data/lib/launchdarkly_api/models/big_segment_target.rb +2 -2
  153. data/lib/launchdarkly_api/models/branch_collection_rep.rb +3 -2
  154. data/lib/launchdarkly_api/models/branch_rep.rb +26 -2
  155. data/lib/launchdarkly_api/models/clause.rb +2 -2
  156. data/lib/launchdarkly_api/models/client_side_availability.rb +2 -2
  157. data/lib/launchdarkly_api/models/client_side_availability_post.rb +2 -2
  158. data/lib/launchdarkly_api/models/condition_base_output_rep.rb +246 -0
  159. data/lib/launchdarkly_api/models/condition_input_rep.rb +256 -0
  160. data/lib/launchdarkly_api/models/condition_output_rep.rb +324 -0
  161. data/lib/launchdarkly_api/models/confidence_interval_rep.rb +2 -2
  162. data/lib/launchdarkly_api/models/conflict.rb +2 -2
  163. data/lib/launchdarkly_api/models/conflict_output_rep.rb +237 -0
  164. data/lib/launchdarkly_api/models/copied_from_env.rb +2 -2
  165. data/lib/launchdarkly_api/models/create_copy_flag_config_approval_request_request.rb +7 -2
  166. data/lib/launchdarkly_api/models/create_flag_config_approval_request_request.rb +2 -2
  167. data/lib/launchdarkly_api/models/custom_property.rb +2 -2
  168. data/lib/launchdarkly_api/models/custom_role.rb +47 -38
  169. data/lib/launchdarkly_api/models/custom_role_post.rb +15 -6
  170. data/lib/launchdarkly_api/models/custom_role_post_data.rb +15 -6
  171. data/lib/launchdarkly_api/models/custom_roles.rb +2 -2
  172. data/lib/launchdarkly_api/models/custom_roles_rep.rb +247 -0
  173. data/lib/launchdarkly_api/models/custom_workflow_input_rep.rb +252 -0
  174. data/lib/launchdarkly_api/models/custom_workflow_meta.rb +227 -0
  175. data/lib/launchdarkly_api/models/custom_workflow_output_rep.rb +354 -0
  176. data/lib/launchdarkly_api/models/custom_workflow_stage_meta.rb +227 -0
  177. data/lib/launchdarkly_api/models/custom_workflows_listing_output_rep.rb +225 -0
  178. data/lib/launchdarkly_api/models/default_client_side_availability_post.rb +2 -2
  179. data/lib/launchdarkly_api/models/defaults.rb +2 -2
  180. data/lib/launchdarkly_api/models/dependent_flag.rb +2 -2
  181. data/lib/launchdarkly_api/models/dependent_flag_environment.rb +2 -2
  182. data/lib/launchdarkly_api/models/dependent_flags_by_environment.rb +2 -2
  183. data/lib/launchdarkly_api/models/derived_attribute.rb +228 -0
  184. data/lib/launchdarkly_api/models/destination.rb +2 -2
  185. data/lib/launchdarkly_api/models/destination_post.rb +2 -2
  186. data/lib/launchdarkly_api/models/destinations.rb +2 -2
  187. data/lib/launchdarkly_api/models/environment.rb +31 -3
  188. data/lib/launchdarkly_api/models/environment_post.rb +2 -2
  189. data/lib/launchdarkly_api/models/execution_output_rep.rb +223 -0
  190. data/lib/launchdarkly_api/models/expanded_team_rep.rb +349 -0
  191. data/lib/launchdarkly_api/models/experiment_allocation_rep.rb +2 -2
  192. data/lib/launchdarkly_api/models/experiment_enabled_period_rep.rb +2 -2
  193. data/lib/launchdarkly_api/models/experiment_environment_setting_rep.rb +2 -2
  194. data/lib/launchdarkly_api/models/experiment_info_rep.rb +2 -2
  195. data/lib/launchdarkly_api/models/experiment_metadata_rep.rb +2 -2
  196. data/lib/launchdarkly_api/models/experiment_rep.rb +2 -2
  197. data/lib/launchdarkly_api/models/experiment_results_rep.rb +15 -6
  198. data/lib/launchdarkly_api/models/experiment_stats_rep.rb +2 -2
  199. data/lib/launchdarkly_api/models/experiment_time_series_slice.rb +2 -2
  200. data/lib/launchdarkly_api/models/experiment_time_series_variation_slice.rb +2 -2
  201. data/lib/launchdarkly_api/models/experiment_totals_rep.rb +2 -2
  202. data/lib/launchdarkly_api/models/expiring_user_target_error.rb +2 -2
  203. data/lib/launchdarkly_api/models/expiring_user_target_get_response.rb +2 -2
  204. data/lib/launchdarkly_api/models/expiring_user_target_item.rb +2 -2
  205. data/lib/launchdarkly_api/models/expiring_user_target_patch_response.rb +2 -2
  206. data/lib/launchdarkly_api/models/extinction.rb +22 -13
  207. data/lib/launchdarkly_api/models/extinction_collection_rep.rb +4 -3
  208. data/lib/launchdarkly_api/models/feature_flag.rb +2 -2
  209. data/lib/launchdarkly_api/models/feature_flag_body.rb +3 -3
  210. data/lib/launchdarkly_api/models/feature_flag_config.rb +2 -2
  211. data/lib/launchdarkly_api/models/feature_flag_scheduled_change.rb +2 -2
  212. data/lib/launchdarkly_api/models/feature_flag_scheduled_changes.rb +2 -2
  213. data/lib/launchdarkly_api/models/feature_flag_status.rb +2 -2
  214. data/lib/launchdarkly_api/models/feature_flag_status_across_environments.rb +2 -2
  215. data/lib/launchdarkly_api/models/feature_flag_statuses.rb +2 -2
  216. data/lib/launchdarkly_api/models/feature_flags.rb +2 -2
  217. data/lib/launchdarkly_api/models/flag_config_approval_request_response.rb +15 -6
  218. data/lib/launchdarkly_api/models/flag_config_approval_requests_response.rb +2 -2
  219. data/lib/launchdarkly_api/models/flag_copy_config_environment.rb +2 -2
  220. data/lib/launchdarkly_api/models/flag_copy_config_post.rb +2 -2
  221. data/lib/launchdarkly_api/models/flag_global_attributes_rep.rb +2 -2
  222. data/lib/launchdarkly_api/models/flag_listing_rep.rb +2 -2
  223. data/lib/launchdarkly_api/models/flag_scheduled_changes_input.rb +2 -2
  224. data/lib/launchdarkly_api/models/flag_status_rep.rb +2 -2
  225. data/lib/launchdarkly_api/models/flag_summary.rb +2 -2
  226. data/lib/launchdarkly_api/models/flag_trigger_input.rb +230 -0
  227. data/lib/launchdarkly_api/models/forbidden_error_rep.rb +227 -0
  228. data/lib/launchdarkly_api/models/hunk_rep.rb +12 -2
  229. data/lib/launchdarkly_api/models/integration.rb +325 -0
  230. data/lib/launchdarkly_api/models/integration_metadata.rb +2 -2
  231. data/lib/launchdarkly_api/models/integration_status.rb +2 -2
  232. data/lib/launchdarkly_api/models/integration_status_rep.rb +236 -0
  233. data/lib/launchdarkly_api/models/integration_subscription_status_rep.rb +256 -0
  234. data/lib/launchdarkly_api/models/integrations.rb +240 -0
  235. data/lib/launchdarkly_api/models/invalid_request_error_rep.rb +227 -0
  236. data/lib/launchdarkly_api/models/ip_list.rb +2 -2
  237. data/lib/launchdarkly_api/models/last_seen_metadata.rb +2 -2
  238. data/lib/launchdarkly_api/models/link.rb +2 -2
  239. data/lib/launchdarkly_api/models/member.rb +20 -6
  240. data/lib/launchdarkly_api/models/member_data_rep.rb +2 -2
  241. data/lib/launchdarkly_api/models/member_import_item_rep.rb +246 -0
  242. data/lib/launchdarkly_api/models/member_permission_grant_summary_rep.rb +2 -2
  243. data/lib/launchdarkly_api/models/member_summary_rep.rb +2 -2
  244. data/lib/launchdarkly_api/models/member_team_summary_rep.rb +2 -2
  245. data/lib/launchdarkly_api/models/member_teams_post_input.rb +226 -0
  246. data/lib/launchdarkly_api/models/members.rb +2 -2
  247. data/lib/launchdarkly_api/models/method_not_allowed_error_rep.rb +227 -0
  248. data/lib/launchdarkly_api/models/metric_collection_rep.rb +2 -2
  249. data/lib/launchdarkly_api/models/metric_listing_rep.rb +15 -3
  250. data/lib/launchdarkly_api/models/metric_post.rb +15 -3
  251. data/lib/launchdarkly_api/models/metric_rep.rb +15 -3
  252. data/lib/launchdarkly_api/models/metric_seen.rb +227 -0
  253. data/lib/launchdarkly_api/models/modification.rb +2 -2
  254. data/lib/launchdarkly_api/models/multi_environment_dependent_flag.rb +2 -2
  255. data/lib/launchdarkly_api/models/multi_environment_dependent_flags.rb +2 -2
  256. data/lib/launchdarkly_api/models/new_member_form.rb +2 -2
  257. data/lib/launchdarkly_api/models/not_found_error_rep.rb +227 -0
  258. data/lib/launchdarkly_api/models/parent_resource_rep.rb +2 -2
  259. data/lib/launchdarkly_api/models/patch_failed_error_rep.rb +227 -0
  260. data/lib/launchdarkly_api/models/patch_operation.rb +2 -2
  261. data/lib/launchdarkly_api/models/patch_segment_instruction.rb +2 -2
  262. data/lib/launchdarkly_api/models/patch_segment_request.rb +2 -2
  263. data/lib/launchdarkly_api/models/patch_with_comment.rb +2 -2
  264. data/lib/launchdarkly_api/models/permission_grant_input.rb +240 -0
  265. data/lib/launchdarkly_api/models/permission_grant_rep.rb +249 -0
  266. data/lib/launchdarkly_api/models/post_approval_request_apply_request.rb +2 -2
  267. data/lib/launchdarkly_api/models/post_approval_request_review_request.rb +2 -2
  268. data/lib/launchdarkly_api/models/post_flag_scheduled_changes_input.rb +2 -2
  269. data/lib/launchdarkly_api/models/prerequisite.rb +2 -2
  270. data/lib/launchdarkly_api/models/project.rb +2 -2
  271. data/lib/launchdarkly_api/models/project_listing_rep.rb +2 -2
  272. data/lib/launchdarkly_api/models/project_post.rb +3 -3
  273. data/lib/launchdarkly_api/models/projects.rb +2 -2
  274. data/lib/launchdarkly_api/models/pub_nub_detail_rep.rb +2 -2
  275. data/lib/launchdarkly_api/models/put_branch.rb +284 -0
  276. data/lib/launchdarkly_api/models/rate_limited_error_rep.rb +227 -0
  277. data/lib/launchdarkly_api/models/recent_trigger_body.rb +229 -0
  278. data/lib/launchdarkly_api/models/reference_rep.rb +14 -2
  279. data/lib/launchdarkly_api/models/relay_auto_config_collection_rep.rb +2 -2
  280. data/lib/launchdarkly_api/models/relay_auto_config_post.rb +2 -2
  281. data/lib/launchdarkly_api/models/relay_auto_config_rep.rb +2 -2
  282. data/lib/launchdarkly_api/models/repository_collection_rep.rb +3 -2
  283. data/lib/launchdarkly_api/models/repository_post.rb +4 -2
  284. data/lib/launchdarkly_api/models/repository_rep.rb +45 -2
  285. data/lib/launchdarkly_api/models/resource_access.rb +2 -2
  286. data/lib/launchdarkly_api/models/resource_id_response.rb +2 -2
  287. data/lib/launchdarkly_api/models/review_output_rep.rb +264 -0
  288. data/lib/launchdarkly_api/models/review_response.rb +2 -2
  289. data/lib/launchdarkly_api/models/rollout.rb +2 -2
  290. data/lib/launchdarkly_api/models/rule.rb +15 -6
  291. data/lib/launchdarkly_api/models/schedule_condition_input_rep.rb +227 -0
  292. data/lib/launchdarkly_api/models/schedule_condition_output_rep.rb +218 -0
  293. data/lib/launchdarkly_api/models/sdk_list_rep.rb +2 -2
  294. data/lib/launchdarkly_api/models/sdk_version_list_rep.rb +2 -2
  295. data/lib/launchdarkly_api/models/sdk_version_rep.rb +2 -2
  296. data/lib/launchdarkly_api/models/segment_body.rb +2 -2
  297. data/lib/launchdarkly_api/models/segment_metadata.rb +2 -2
  298. data/lib/launchdarkly_api/models/segment_user_list.rb +2 -2
  299. data/lib/launchdarkly_api/models/segment_user_state.rb +2 -2
  300. data/lib/launchdarkly_api/models/series_list_rep.rb +2 -2
  301. data/lib/launchdarkly_api/models/source_flag.rb +2 -2
  302. data/lib/launchdarkly_api/models/stage_input_rep.rb +238 -0
  303. data/lib/launchdarkly_api/models/stage_output_rep.rb +276 -0
  304. data/lib/launchdarkly_api/models/statement.rb +8 -4
  305. data/lib/launchdarkly_api/models/statement_post.rb +2 -2
  306. data/lib/launchdarkly_api/models/statement_post_data.rb +2 -2
  307. data/lib/launchdarkly_api/models/statement_rep.rb +9 -4
  308. data/lib/launchdarkly_api/models/statistic_collection_rep.rb +2 -2
  309. data/lib/launchdarkly_api/models/statistic_rep.rb +2 -2
  310. data/lib/launchdarkly_api/models/statistics_root.rb +2 -2
  311. data/lib/launchdarkly_api/models/status_conflict_error_rep.rb +227 -0
  312. data/lib/launchdarkly_api/models/subject_data_rep.rb +2 -2
  313. data/lib/launchdarkly_api/models/subscription_post.rb +293 -0
  314. data/lib/launchdarkly_api/models/target.rb +2 -2
  315. data/lib/launchdarkly_api/models/target_resource_rep.rb +2 -2
  316. data/lib/launchdarkly_api/models/team_collection_rep.rb +240 -0
  317. data/lib/launchdarkly_api/models/team_imports_rep.rb +220 -0
  318. data/lib/launchdarkly_api/models/team_patch_input.rb +229 -0
  319. data/lib/launchdarkly_api/models/team_post_input.rb +285 -0
  320. data/lib/launchdarkly_api/models/team_rep.rb +327 -0
  321. data/lib/launchdarkly_api/models/title_rep.rb +2 -2
  322. data/lib/launchdarkly_api/models/token.rb +2 -2
  323. data/lib/launchdarkly_api/models/token_data_rep.rb +2 -2
  324. data/lib/launchdarkly_api/models/tokens.rb +2 -2
  325. data/lib/launchdarkly_api/models/trigger_post.rb +245 -0
  326. data/lib/launchdarkly_api/models/trigger_workflow_collection_rep.rb +231 -0
  327. data/lib/launchdarkly_api/models/trigger_workflow_rep.rb +332 -0
  328. data/lib/launchdarkly_api/models/unauthorized_error_rep.rb +227 -0
  329. data/lib/launchdarkly_api/models/url_post.rb +2 -2
  330. data/lib/launchdarkly_api/models/user.rb +104 -47
  331. data/lib/launchdarkly_api/models/user_attribute_names_rep.rb +2 -2
  332. data/lib/launchdarkly_api/models/user_flag_setting.rb +2 -2
  333. data/lib/launchdarkly_api/models/user_flag_settings.rb +2 -2
  334. data/lib/launchdarkly_api/models/user_record.rb +27 -7
  335. data/lib/launchdarkly_api/models/user_record_rep.rb +255 -0
  336. data/lib/launchdarkly_api/models/user_segment.rb +15 -6
  337. data/lib/launchdarkly_api/models/user_segment_rule.rb +2 -2
  338. data/lib/launchdarkly_api/models/user_segments.rb +2 -2
  339. data/lib/launchdarkly_api/models/users.rb +3 -3
  340. data/lib/launchdarkly_api/models/value_put.rb +2 -2
  341. data/lib/launchdarkly_api/models/variation.rb +2 -2
  342. data/lib/launchdarkly_api/models/variation_or_rollout_rep.rb +2 -2
  343. data/lib/launchdarkly_api/models/variation_summary.rb +2 -2
  344. data/lib/launchdarkly_api/models/versions_rep.rb +2 -2
  345. data/lib/launchdarkly_api/models/webhook.rb +2 -2
  346. data/lib/launchdarkly_api/models/webhook_post.rb +2 -2
  347. data/lib/launchdarkly_api/models/webhooks.rb +2 -2
  348. data/lib/launchdarkly_api/models/weighted_variation.rb +2 -2
  349. data/lib/launchdarkly_api/version.rb +3 -3
  350. data/lib/launchdarkly_api.rb +58 -7
  351. data/spec/api/access_tokens_api_spec.rb +2 -2
  352. data/spec/api/account_members_api_spec.rb +20 -7
  353. data/spec/api/account_usage_beta_api_spec.rb +2 -2
  354. data/spec/api/approvals_api_spec.rb +2 -2
  355. data/spec/api/audit_log_api_spec.rb +2 -2
  356. data/spec/api/code_references_api_spec.rb +9 -7
  357. data/spec/api/custom_roles_api_spec.rb +4 -4
  358. data/spec/api/data_export_destinations_api_spec.rb +2 -2
  359. data/spec/api/environments_api_spec.rb +4 -4
  360. data/spec/api/experiments_beta_api_spec.rb +2 -2
  361. data/spec/api/feature_flags_api_spec.rb +3 -4
  362. data/spec/api/feature_flags_beta_api_spec.rb +2 -2
  363. data/spec/api/flag_triggers_api_spec.rb +110 -0
  364. data/spec/api/integration_audit_log_subscriptions_api_spec.rb +100 -0
  365. data/spec/api/metrics_api_spec.rb +3 -3
  366. data/spec/api/other_api_spec.rb +3 -3
  367. data/spec/api/projects_api_spec.rb +3 -3
  368. data/spec/api/relay_proxy_configurations_api_spec.rb +2 -2
  369. data/spec/api/scheduled_changes_api_spec.rb +3 -3
  370. data/spec/api/segments_api_spec.rb +5 -5
  371. data/spec/api/teams_beta_api_spec.rb +111 -0
  372. data/spec/api/user_settings_api_spec.rb +2 -2
  373. data/spec/api/users_api_spec.rb +6 -4
  374. data/spec/api/users_beta_api_spec.rb +2 -2
  375. data/spec/api/webhooks_api_spec.rb +2 -2
  376. data/spec/api/workflows_beta_api_spec.rb +94 -0
  377. data/spec/api_client_spec.rb +4 -4
  378. data/spec/configuration_spec.rb +2 -2
  379. data/spec/models/access_denied_reason_rep_spec.rb +2 -2
  380. data/spec/models/access_denied_rep_spec.rb +2 -2
  381. data/spec/models/access_rep_spec.rb +2 -2
  382. data/spec/models/access_token_post_spec.rb +2 -2
  383. data/spec/models/action_input_rep_spec.rb +34 -0
  384. data/spec/models/action_output_rep_spec.rb +40 -0
  385. data/spec/models/approval_condition_input_rep_spec.rb +40 -0
  386. data/spec/models/approval_condition_output_rep_spec.rb +58 -0
  387. data/spec/models/approval_settings_spec.rb +2 -2
  388. data/spec/models/audit_log_entry_listing_rep_collection_spec.rb +2 -2
  389. data/spec/models/audit_log_entry_listing_rep_spec.rb +2 -2
  390. data/spec/models/audit_log_entry_rep_spec.rb +2 -2
  391. data/spec/models/authorized_app_data_rep_spec.rb +2 -2
  392. data/spec/models/big_segment_target_spec.rb +2 -2
  393. data/spec/models/branch_collection_rep_spec.rb +2 -2
  394. data/spec/models/branch_rep_spec.rb +2 -2
  395. data/spec/models/clause_spec.rb +2 -2
  396. data/spec/models/client_side_availability_post_spec.rb +2 -2
  397. data/spec/models/client_side_availability_spec.rb +2 -2
  398. data/spec/models/condition_base_output_rep_spec.rb +46 -0
  399. data/spec/models/condition_input_rep_spec.rb +58 -0
  400. data/spec/models/condition_output_rep_spec.rb +82 -0
  401. data/spec/models/confidence_interval_rep_spec.rb +2 -2
  402. data/spec/models/conflict_output_rep_spec.rb +40 -0
  403. data/spec/models/conflict_spec.rb +2 -2
  404. data/spec/models/copied_from_env_spec.rb +2 -2
  405. data/spec/models/create_copy_flag_config_approval_request_request_spec.rb +2 -2
  406. data/spec/models/create_flag_config_approval_request_request_spec.rb +2 -2
  407. data/spec/models/custom_property_spec.rb +2 -2
  408. data/spec/models/custom_role_post_data_spec.rb +8 -2
  409. data/spec/models/custom_role_post_spec.rb +8 -2
  410. data/spec/models/custom_role_spec.rb +13 -7
  411. data/spec/models/custom_roles_rep_spec.rb +52 -0
  412. data/spec/models/custom_roles_spec.rb +2 -2
  413. data/spec/models/custom_workflow_input_rep_spec.rb +52 -0
  414. data/spec/models/custom_workflow_meta_spec.rb +40 -0
  415. data/spec/models/custom_workflow_output_rep_spec.rb +94 -0
  416. data/spec/models/custom_workflow_stage_meta_spec.rb +40 -0
  417. data/spec/models/custom_workflows_listing_output_rep_spec.rb +34 -0
  418. data/spec/models/default_client_side_availability_post_spec.rb +2 -2
  419. data/spec/models/defaults_spec.rb +2 -2
  420. data/spec/models/dependent_flag_environment_spec.rb +2 -2
  421. data/spec/models/dependent_flag_spec.rb +2 -2
  422. data/spec/models/dependent_flags_by_environment_spec.rb +2 -2
  423. data/spec/models/derived_attribute_spec.rb +40 -0
  424. data/spec/models/destination_post_spec.rb +2 -2
  425. data/spec/models/destination_spec.rb +2 -2
  426. data/spec/models/destinations_spec.rb +2 -2
  427. data/spec/models/environment_post_spec.rb +2 -2
  428. data/spec/models/environment_spec.rb +14 -2
  429. data/spec/models/execution_output_rep_spec.rb +34 -0
  430. data/spec/models/expanded_team_rep_spec.rb +112 -0
  431. data/spec/models/experiment_allocation_rep_spec.rb +2 -2
  432. data/spec/models/experiment_enabled_period_rep_spec.rb +2 -2
  433. data/spec/models/experiment_environment_setting_rep_spec.rb +2 -2
  434. data/spec/models/experiment_info_rep_spec.rb +2 -2
  435. data/spec/models/experiment_metadata_rep_spec.rb +2 -2
  436. data/spec/models/experiment_rep_spec.rb +2 -2
  437. data/spec/models/experiment_results_rep_spec.rb +8 -2
  438. data/spec/models/experiment_stats_rep_spec.rb +2 -2
  439. data/spec/models/experiment_time_series_slice_spec.rb +2 -2
  440. data/spec/models/experiment_time_series_variation_slice_spec.rb +2 -2
  441. data/spec/models/experiment_totals_rep_spec.rb +2 -2
  442. data/spec/models/expiring_user_target_error_spec.rb +2 -2
  443. data/spec/models/expiring_user_target_get_response_spec.rb +2 -2
  444. data/spec/models/expiring_user_target_item_spec.rb +2 -2
  445. data/spec/models/expiring_user_target_patch_response_spec.rb +2 -2
  446. data/spec/models/extinction_collection_rep_spec.rb +2 -2
  447. data/spec/models/extinction_spec.rb +3 -3
  448. data/spec/models/feature_flag_body_spec.rb +2 -2
  449. data/spec/models/feature_flag_config_spec.rb +2 -2
  450. data/spec/models/feature_flag_scheduled_change_spec.rb +2 -2
  451. data/spec/models/feature_flag_scheduled_changes_spec.rb +2 -2
  452. data/spec/models/feature_flag_spec.rb +2 -2
  453. data/spec/models/feature_flag_status_across_environments_spec.rb +2 -2
  454. data/spec/models/feature_flag_status_spec.rb +2 -2
  455. data/spec/models/feature_flag_statuses_spec.rb +2 -2
  456. data/spec/models/feature_flags_spec.rb +2 -2
  457. data/spec/models/flag_config_approval_request_response_spec.rb +8 -2
  458. data/spec/models/flag_config_approval_requests_response_spec.rb +2 -2
  459. data/spec/models/flag_copy_config_environment_spec.rb +2 -2
  460. data/spec/models/flag_copy_config_post_spec.rb +2 -2
  461. data/spec/models/flag_global_attributes_rep_spec.rb +2 -2
  462. data/spec/models/flag_listing_rep_spec.rb +2 -2
  463. data/spec/models/flag_scheduled_changes_input_spec.rb +2 -2
  464. data/spec/models/flag_status_rep_spec.rb +2 -2
  465. data/spec/models/flag_summary_spec.rb +2 -2
  466. data/spec/models/flag_trigger_input_spec.rb +40 -0
  467. data/spec/models/forbidden_error_rep_spec.rb +40 -0
  468. data/spec/models/hunk_rep_spec.rb +2 -2
  469. data/spec/models/integration_metadata_spec.rb +2 -2
  470. data/spec/models/integration_spec.rb +100 -0
  471. data/spec/models/integration_status_rep_spec.rb +46 -0
  472. data/spec/models/integration_status_spec.rb +2 -2
  473. data/spec/models/integration_subscription_status_rep_spec.rb +58 -0
  474. data/spec/models/integrations_spec.rb +46 -0
  475. data/spec/models/invalid_request_error_rep_spec.rb +40 -0
  476. data/spec/models/ip_list_spec.rb +2 -2
  477. data/spec/models/last_seen_metadata_spec.rb +2 -2
  478. data/spec/models/link_spec.rb +2 -2
  479. data/spec/models/member_data_rep_spec.rb +2 -2
  480. data/spec/models/member_import_item_rep_spec.rb +46 -0
  481. data/spec/models/member_permission_grant_summary_rep_spec.rb +2 -2
  482. data/spec/models/member_spec.rb +8 -2
  483. data/spec/models/member_summary_rep_spec.rb +2 -2
  484. data/spec/models/member_team_summary_rep_spec.rb +2 -2
  485. data/spec/models/member_teams_post_input_spec.rb +34 -0
  486. data/spec/models/members_spec.rb +2 -2
  487. data/spec/models/method_not_allowed_error_rep_spec.rb +40 -0
  488. data/spec/models/metric_collection_rep_spec.rb +2 -2
  489. data/spec/models/metric_listing_rep_spec.rb +6 -2
  490. data/spec/models/metric_post_spec.rb +6 -2
  491. data/spec/models/metric_rep_spec.rb +6 -2
  492. data/spec/models/metric_seen_spec.rb +40 -0
  493. data/spec/models/modification_spec.rb +2 -2
  494. data/spec/models/multi_environment_dependent_flag_spec.rb +2 -2
  495. data/spec/models/multi_environment_dependent_flags_spec.rb +2 -2
  496. data/spec/models/new_member_form_spec.rb +2 -2
  497. data/spec/models/not_found_error_rep_spec.rb +40 -0
  498. data/spec/models/parent_resource_rep_spec.rb +2 -2
  499. data/spec/models/patch_failed_error_rep_spec.rb +40 -0
  500. data/spec/models/patch_operation_spec.rb +2 -2
  501. data/spec/models/patch_segment_instruction_spec.rb +2 -2
  502. data/spec/models/patch_segment_request_spec.rb +2 -2
  503. data/spec/models/patch_with_comment_spec.rb +2 -2
  504. data/spec/models/permission_grant_input_spec.rb +46 -0
  505. data/spec/models/permission_grant_rep_spec.rb +52 -0
  506. data/spec/models/post_approval_request_apply_request_spec.rb +2 -2
  507. data/spec/models/post_approval_request_review_request_spec.rb +2 -2
  508. data/spec/models/post_flag_scheduled_changes_input_spec.rb +2 -2
  509. data/spec/models/prerequisite_spec.rb +2 -2
  510. data/spec/models/project_listing_rep_spec.rb +2 -2
  511. data/spec/models/project_post_spec.rb +2 -2
  512. data/spec/models/project_spec.rb +2 -2
  513. data/spec/models/projects_spec.rb +2 -2
  514. data/spec/models/pub_nub_detail_rep_spec.rb +2 -2
  515. data/spec/models/put_branch_spec.rb +64 -0
  516. data/spec/models/rate_limited_error_rep_spec.rb +40 -0
  517. data/spec/models/recent_trigger_body_spec.rb +40 -0
  518. data/spec/models/reference_rep_spec.rb +2 -2
  519. data/spec/models/relay_auto_config_collection_rep_spec.rb +2 -2
  520. data/spec/models/relay_auto_config_post_spec.rb +2 -2
  521. data/spec/models/relay_auto_config_rep_spec.rb +2 -2
  522. data/spec/models/repository_collection_rep_spec.rb +2 -2
  523. data/spec/models/repository_post_spec.rb +2 -2
  524. data/spec/models/repository_rep_spec.rb +6 -2
  525. data/spec/models/resource_access_spec.rb +2 -2
  526. data/spec/models/resource_id_response_spec.rb +2 -2
  527. data/spec/models/review_output_rep_spec.rb +58 -0
  528. data/spec/models/review_response_spec.rb +2 -2
  529. data/spec/models/rollout_spec.rb +2 -2
  530. data/spec/models/rule_spec.rb +8 -2
  531. data/spec/models/schedule_condition_input_rep_spec.rb +40 -0
  532. data/spec/models/schedule_condition_output_rep_spec.rb +34 -0
  533. data/spec/models/sdk_list_rep_spec.rb +2 -2
  534. data/spec/models/sdk_version_list_rep_spec.rb +2 -2
  535. data/spec/models/sdk_version_rep_spec.rb +2 -2
  536. data/spec/models/segment_body_spec.rb +2 -2
  537. data/spec/models/segment_metadata_spec.rb +2 -2
  538. data/spec/models/segment_user_list_spec.rb +2 -2
  539. data/spec/models/segment_user_state_spec.rb +2 -2
  540. data/spec/models/series_list_rep_spec.rb +2 -2
  541. data/spec/models/source_flag_spec.rb +2 -2
  542. data/spec/models/stage_input_rep_spec.rb +46 -0
  543. data/spec/models/stage_output_rep_spec.rb +58 -0
  544. data/spec/models/statement_post_data_spec.rb +2 -2
  545. data/spec/models/statement_post_spec.rb +2 -2
  546. data/spec/models/statement_rep_spec.rb +2 -2
  547. data/spec/models/statement_spec.rb +2 -2
  548. data/spec/models/statistic_collection_rep_spec.rb +2 -2
  549. data/spec/models/statistic_rep_spec.rb +2 -2
  550. data/spec/models/statistics_root_spec.rb +2 -2
  551. data/spec/models/status_conflict_error_rep_spec.rb +40 -0
  552. data/spec/models/subject_data_rep_spec.rb +2 -2
  553. data/spec/models/subscription_post_spec.rb +70 -0
  554. data/spec/models/target_resource_rep_spec.rb +2 -2
  555. data/spec/models/target_spec.rb +2 -2
  556. data/spec/models/team_collection_rep_spec.rb +46 -0
  557. data/spec/models/team_imports_rep_spec.rb +34 -0
  558. data/spec/models/team_patch_input_spec.rb +40 -0
  559. data/spec/models/team_post_input_spec.rb +64 -0
  560. data/spec/models/team_rep_spec.rb +100 -0
  561. data/spec/models/title_rep_spec.rb +2 -2
  562. data/spec/models/token_data_rep_spec.rb +2 -2
  563. data/spec/models/token_spec.rb +2 -2
  564. data/spec/models/tokens_spec.rb +2 -2
  565. data/spec/models/trigger_post_spec.rb +46 -0
  566. data/spec/models/trigger_workflow_collection_rep_spec.rb +40 -0
  567. data/spec/models/trigger_workflow_rep_spec.rb +106 -0
  568. data/spec/models/unauthorized_error_rep_spec.rb +40 -0
  569. data/spec/models/url_post_spec.rb +2 -2
  570. data/spec/models/user_attribute_names_rep_spec.rb +2 -2
  571. data/spec/models/user_flag_setting_spec.rb +2 -2
  572. data/spec/models/user_flag_settings_spec.rb +2 -2
  573. data/spec/models/user_record_rep_spec.rb +58 -0
  574. data/spec/models/user_record_spec.rb +14 -2
  575. data/spec/models/user_segment_rule_spec.rb +2 -2
  576. data/spec/models/user_segment_spec.rb +8 -2
  577. data/spec/models/user_segments_spec.rb +2 -2
  578. data/spec/models/user_spec.rb +45 -9
  579. data/spec/models/users_spec.rb +2 -2
  580. data/spec/models/value_put_spec.rb +2 -2
  581. data/spec/models/variation_or_rollout_rep_spec.rb +2 -2
  582. data/spec/models/variation_spec.rb +2 -2
  583. data/spec/models/variation_summary_spec.rb +2 -2
  584. data/spec/models/versions_rep_spec.rb +2 -2
  585. data/spec/models/webhook_post_spec.rb +2 -2
  586. data/spec/models/webhook_spec.rb +2 -2
  587. data/spec/models/webhooks_spec.rb +2 -2
  588. data/spec/models/weighted_variation_spec.rb +2 -2
  589. data/spec/spec_helper.rb +2 -2
  590. metadata +474 -270
  591. data/docs/ExtinctionRep.md +0 -26
  592. data/docs/InlineObject.md +0 -26
  593. data/docs/InlineObject1.md +0 -28
  594. data/docs/InlineResponse200.md +0 -20
  595. data/docs/Variate.md +0 -24
  596. data/lib/launchdarkly_api/models/extinction_rep.rb +0 -279
  597. data/lib/launchdarkly_api/models/inline_object.rb +0 -274
  598. data/lib/launchdarkly_api/models/inline_object1.rb +0 -276
  599. data/lib/launchdarkly_api/models/inline_response200.rb +0 -227
  600. data/lib/launchdarkly_api/models/variate.rb +0 -246
  601. data/spec/models/extinction_rep_spec.rb +0 -58
  602. data/spec/models/inline_object1_spec.rb +0 -64
  603. data/spec/models/inline_object_spec.rb +0 -58
  604. data/spec/models/inline_response200_spec.rb +0 -40
  605. data/spec/models/variate_spec.rb +0 -52
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #LaunchDarkly REST API
3
3
 
4
- ## Authentication All REST API resources are authenticated with either [personal or service access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens), or session cookies. Other authentication mechanisms are not supported. You can manage personal access tokens on your [Account settings](https://app.launchdarkly.com/settings/tokens) page. LaunchDarkly also has SDK keys, mobile keys, and client-side IDs that are used by our server-side SDKs, mobile SDKs, and client-side SDKs, respectively. **These keys cannot be used to access our REST API**. These keys are environment-specific, and can only perform read-only operations (fetching feature flag settings). | Auth mechanism | Allowed resources | Use cases | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------- | | [Personal access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens) | Can be customized on a per-token basis | Building scripts, custom integrations, data export | | SDK keys | Can only access read-only SDK-specific resources and the firehose, restricted to a single environment | Server-side SDKs, Firehose API | | Mobile keys | Can only access read-only mobile SDK-specific resources, restricted to a single environment | Mobile SDKs | | Client-side ID | Single environment, only flags marked available to client-side | Client-side JavaScript | > ### Keep your access tokens and SDK keys private > > Access tokens should _never_ be exposed in untrusted contexts. Never put an access token in client-side JavaScript, or embed it in a mobile application. LaunchDarkly has special mobile keys that you can embed in mobile apps. If you accidentally expose an access token or SDK key, you can reset it from your [Account Settings](https://app.launchdarkly.com/settings#/tokens) page. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ## Via request header The preferred way to authenticate with the API is by adding an `Authorization` header containing your access token to your requests. The value of the `Authorization` header must be your access token. Manage personal access tokens from the [Account Settings](https://app.launchdarkly.com/settings/tokens) page. ## Via session cookie For testing purposes, you can make API calls directly from your web browser. If you're logged in to the application, the API will use your existing session to authenticate calls. If you have a [role](https://docs.launchdarkly.com/home/team/built-in-roles) other than Admin, or have a [custom role](https://docs.launchdarkly.com/home/team/custom-roles) defined, you may not have permission to perform some API calls. You will receive a `401` response code in that case. > ### Modifying the Origin header causes an error > > LaunchDarkly validates that the Origin header for any API request authenticated by a session cookie matches the expected Origin header. The expected Origin header is `https://app.launchdarkly.com`. > > If the Origin header does not match what's expected, LaunchDarkly returns an error. This error can prevent the LaunchDarkly app from working correctly. > > Any browser extension that intentionally changes the Origin header can cause this problem. For example, the `Allow-Control-Allow-Origin: *` Chrome extension changes the Origin header to `http://evil.com` and causes the app to fail. > > To prevent this error, do not modify your Origin header. > > LaunchDarkly does not require origin matching when authenticating with an access token, so this issue does not affect normal API usage. # Representations All resources expect and return JSON response bodies. Error responses will also send a JSON body. Read [Errors](#section/Errors) for a more detailed description of the error format used by the API. In practice this means that you always get a response with a `Content-Type` header set to `application/json`. In addition, request bodies for `PUT`, `POST`, `REPORT` and `PATCH` requests must be encoded as JSON with a `Content-Type` header set to `application/json`. ## Summary and detailed representations When you fetch a list of resources, the response includes only the most important attributes of each resource. This is a _summary representation_ of the resource. When you fetch an individual resource (for example, a single feature flag), you receive a _detailed representation_ containing all of the attributes of the resource. The best way to find a detailed representation is to follow links. Every summary representation includes a link to its detailed representation. ## Links and addressability The best way to navigate the API is by following links. These are attributes in representations that link to other resources. The API always uses the same format for links: - Links to other resources within the API are encapsulated in a `_links` object. - If the resource has a corresponding link to HTML content on the site, it is stored in a special `_site` link. Each link has two attributes: an href (the URL) and a type (the content type). For example, a feature resource might return the following: ```json { \"_links\": { \"parent\": { \"href\": \"/api/features\", \"type\": \"application/json\" }, \"self\": { \"href\": \"/api/features/sort.order\", \"type\": \"application/json\" } }, \"_site\": { \"href\": \"/features/sort.order\", \"type\": \"text/html\" } } ``` From this, you can navigate to the parent collection of features by following the `parent` link, or navigate to the site page for the feature by following the `_site` link. Collections are always represented as a JSON object with an `items` attribute containing an array of representations. Like all other representations, collections have `_links` defined at the top level. Paginated collections include `first`, `last`, `next`, and `prev` links containing a URL with the respective set of elements in the collection. # Updates Resources that accept partial updates use the `PATCH` verb, and support the [JSON Patch](http://tools.ietf.org/html/rfc6902) format. Some resources also support the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) format. In addition, some resources support optional comments that can be submitted with updates. Comments appear in outgoing webhooks, the audit log, and other integrations. ## Updates via JSON Patch [JSON Patch](http://tools.ietf.org/html/rfc6902) is a way to specify the modifications to perform on a resource. For example, in this feature flag representation: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"description\": \"This is the description\", ... } ``` You can change the feature flag's description with the following patch document: ```json [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"This is the new description\" }] ``` JSON Patch documents are always arrays. You can specify multiple modifications to perform in a single request. You can also test that certain preconditions are met before applying the patch: ```json [ { \"op\": \"test\", \"path\": \"/version\", \"value\": 10 }, { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" } ] ``` The above patch request tests whether the feature flag's `version` is `10`, and if so, changes the feature flag's description. Attributes that aren't editable, like a resource's `_links`, have names that start with an underscore. ## Updates via JSON Merge Patch The API also supports the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) format, as well as the [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource. JSON Merge Patch is less expressive than JSON Patch but in many cases, it is simpler to construct a merge patch document. For example, you can change a feature flag's description with the following merge patch document: ```json { \"description\": \"New flag description\" } ``` ## Updates with comments You can submit optional comments with `PATCH` changes. The [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource supports comments. To submit a comment along with a JSON Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"patch\": [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" }] } ``` To submit a comment along with a JSON Merge Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"merge\": { \"description\": \"New flag description\" } } ``` ## Updates via semantic patches The API also supports the Semantic patch format. A semantic `PATCH` is a way to specify the modifications to perform on a resource as a set of executable instructions. JSON Patch uses paths and a limited set of operations to describe how to transform the current state of the resource into a new state. Semantic patch allows you to be explicit about intent using precise, custom instructions. In many cases, semantic patch instructions can also be defined independently of the current state of the resource. This can be useful when defining a change that may be applied at a future date. For example, in this feature flag configuration in environment Production: ```json { \"name\": \"Alternate sort order\", \"kind\": \"boolean\", \"key\": \"sort.order\", ... \"environments\": { \"production\": { \"on\": true, \"archived\": false, \"salt\": \"c29ydC5vcmRlcg==\", \"sel\": \"8de1085cb7354b0ab41c0e778376dfd3\", \"lastModified\": 1469131558260, \"version\": 81, \"targets\": [ { \"values\": [ \"Gerhard.Little@yahoo.com\" ], \"variation\": 0 }, { \"values\": [ \"1461797806429-33-861961230\", \"438580d8-02ee-418d-9eec-0085cab2bdf0\" ], \"variation\": 1 } ], \"rules\": [], \"fallthrough\": { \"variation\": 0 }, \"offVariation\": 1, \"prerequisites\": [], \"_site\": { \"href\": \"/default/production/features/sort.order\", \"type\": \"text/html\" } } } } ``` You can add a date you want a user to be removed from the feature flag's user targets. For example, “remove user 1461797806429-33-861961230 from the user target for variation 0 on the Alternate sort order flag in the production environment on Wed Jul 08 2020 at 15:27:41 pm”. This is done using the following: ```json { \"comment\": \"update expiring user targets\", \"instructions\": [ { \"kind\": \"removeExpireUserTargetDate\", \"userKey\": \"userKey\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\" }, { \"kind\": \"updateExpireUserTargetDate\", \"userKey\": \"userKey2\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1587582000000 }, { \"kind\": \"addExpireUserTargetDate\", \"userKey\": \"userKey3\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1594247266386 } ] } ``` Here is another example. In this feature flag configuration: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"environments\": { \"test\": { \"on\": true } } } ``` You can change the feature flag's description with the following patch document as a set of executable instructions. For example, “add user X to targets for variation Y and remove user A from targets for variation B for test flag”: ```json { \"comment\": \"\", \"instructions\": [ { \"kind\": \"removeUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"852cb784-54ff-46b9-8c35-5498d2e4f270\" }, { \"kind\": \"addUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"1bb18465-33b6-49aa-a3bd-eeb6650b33ad\" } ] } ``` > ### Supported semantic patch API endpoints > > - [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) > - [Update expiring user targets on feature flag](/tag/Feature-flags#operation/patchExpiringUserTargets) > - [Update expiring user target for flags](/tag/User-Settings#operation/patchExpiringFlagsForUser) > - [Update expiring user targets on segment](/tag/Segments#operation/patchExpiringUserTargetsOnSegment) # Errors The API always returns errors in a common format. Here's an example: ```json { \"code\": \"invalid_request\", \"message\": \"A feature with that key already exists\", \"id\": \"30ce6058-87da-11e4-b116-123b93f75cba\" } ``` The general class of error is indicated by the `code`. The `message` is a human-readable explanation of what went wrong. The `id` is a unique identifier. Use it when you're working with LaunchDarkly support to debug a problem with a specific API call. ## HTTP Status - Error Response Codes | Code | Definition | Desc. | Possible Solution | | ---- | ----------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | 400 | Bad Request | A request that fails may return this HTTP response code. | Ensure JSON syntax in request body is correct. | | 401 | Unauthorized | User doesn't have permission to an API call. | Ensure your SDK key is good. | | 403 | Forbidden | User does not have permission for operation. | Ensure that the user or access token has proper permissions set. | | 409 | Conflict | The API request could not be completed because it conflicted with a concurrent API request. | Retry your request. | | 429 | Too many requests | See [Rate limiting](/#section/Rate-limiting). | Wait and try again later. | # CORS The LaunchDarkly API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin. If an `Origin` header is given in a request, it will be echoed as an explicitly allowed origin. Otherwise, a wildcard is returned: `Access-Control-Allow-Origin: *`. For more information on CORS, see the [CORS W3C Recommendation](http://www.w3.org/TR/cors). Example CORS headers might look like: ```http Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, Authorization Access-Control-Allow-Methods: OPTIONS, GET, DELETE, PATCH Access-Control-Allow-Origin: * Access-Control-Max-Age: 300 ``` You can make authenticated CORS calls just as you would make same-origin calls, using either [token or session-based authentication](#section/Authentication). If you’re using session auth, you should set the `withCredentials` property for your `xhr` request to `true`. You should never expose your access tokens to untrusted users. # Rate limiting We use several rate limiting strategies to ensure the availability of our APIs. Rate-limited calls to our APIs will return a `429` status code. Calls to our APIs will include headers indicating the current rate limit status. The specific headers returned depend on the API route being called. The limits differ based on the route, authentication mechanism, and other factors. Routes that are not rate limited may not contain any of the headers described below. > ### Rate limiting and SDKs > > LaunchDarkly SDKs are never rate limited and do not use the API endpoints defined here. LaunchDarkly uses a different set of approaches, including streaming/server-sent events and a global CDN, to ensure availability to the routes used by LaunchDarkly SDKs. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ## Global rate limits Authenticated requests are subject to a global limit. This is the maximum number of calls that can be made to the API per ten seconds. All personal access tokens on the account share this limit, so exceeding the limit with one access token will impact other tokens. Calls that are subject to global rate limits will return the headers below: | Header name | Description | | ------------------------------ | -------------------------------------------------------------------------------- | | `X-Ratelimit-Global-Remaining` | The maximum number of requests the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | We do not publicly document the specific number of calls that can be made globally. This limit may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limit. ## Route-level rate limits Some authenticated routes have custom rate limits. These also reset every ten seconds. Any access tokens hitting the same route share this limit, so exceeding the limit with one access token may impact other tokens. Calls that are subject to route-level rate limits will return the headers below: | Header name | Description | | ----------------------------- | ----------------------------------------------------------------------------------------------------- | | `X-Ratelimit-Route-Remaining` | The maximum number of requests to the current route the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | A _route_ represents a specific URL pattern and verb. For example, the [Delete environment](/tag/Environments#operation/deleteEnvironment) endpoint is considered a single route, and each call to delete an environment counts against your route-level rate limit for that route. We do not publicly document the specific number of calls that can be made to each endpoint per ten seconds. These limits may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limits. ## IP-based rate limiting We also employ IP-based rate limiting on some API routes. If you hit an IP-based rate limit, your API response will include a `Retry-After` header indicating how long to wait before re-trying the call. Clients must wait at least `Retry-After` seconds before making additional calls to our API, and should employ jitter and backoff strategies to avoid triggering rate limits again. # OpenAPI (Swagger) We have a [complete OpenAPI (Swagger) specification](https://app.launchdarkly.com/api/v2/openapi.json) for our API. You can use this specification to generate client libraries to interact with our REST API in your language of choice. This specification is supported by several API-based tools such as Postman and Insomnia. In many cases, you can directly import our specification to ease use in navigating the APIs in the tooling. # Client libraries We auto-generate multiple client libraries based on our OpenAPI specification. To learn more, visit [GitHub](https://github.com/search?q=topic%3Alaunchdarkly-api+org%3Alaunchdarkly&type=Repositories). # Method Overriding Some firewalls and HTTP clients restrict the use of verbs other than `GET` and `POST`. In those environments, our API endpoints that use `PUT`, `PATCH`, and `DELETE` verbs will be inaccessible. To avoid this issue, our API supports the `X-HTTP-Method-Override` header, allowing clients to \"tunnel\" `PUT`, `PATCH`, and `DELETE` requests via a `POST` request. For example, if you wish to call one of our `PATCH` resources via a `POST` request, you can include `X-HTTP-Method-Override:PATCH` as a header. # Beta resources We sometimes release new API resources in **beta** status before we release them with general availability. Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. We try to promote resources into general availability as quickly as possible. This happens after sufficient testing and when we're satisfied that we no longer need to make backwards-incompatible changes. We mark beta resources with a \"Beta\" callout in our documentation, pictured below: > ### This feature is in beta > > To use this feature, pass in a header including the `LD-API-Version` key with value set to `beta`. Use this header with each call. To learn more, read [Beta resources](/#section/Beta-resources). ## Using beta resources To use a beta resource, you must include a header in the request. If you call a beta resource without this header, you'll receive a `403` response. Use this header: ``` LD-API-Version: beta ``` # Versioning We try hard to keep our REST API backwards compatible, but we occasionally have to make backwards-incompatible changes in the process of shipping new features. These breaking changes can cause unexpected behavior if you don't prepare for them accordingly. Updates to our REST API include support for the latest features in LaunchDarkly. We also release a new version of our REST API every time we make a breaking change. We provide simultaneous support for multiple API versions so you can migrate from your current API version to a new version at your own pace. ## Setting the API version per request You can set the API version on a specific request by sending an `LD-API-Version` header, as shown in the example below: ``` LD-API-Version: 20191212 ``` The header value is the version number of the API version you'd like to request. The number for each version corresponds to the date the version was released. In the example above the version `20191212` corresponds to December 12, 2019. ## Setting the API version per access token When creating an access token, you must specify a specific version of the API to use. This ensures that integrations using this token cannot be broken by version changes. Tokens created before versioning was released have their version set to `20160426` (the version of the API that existed before versioning) so that they continue working the same way they did before versioning. If you would like to upgrade your integration to use a new API version, you can explicitly set the header described above. > ### Best practice: Set the header for every client or integration > > We recommend that you set the API version header explicitly in any client or integration you build. > > Only rely on the access token API version during manual testing.
4
+ ## Overview ## Authentication All REST API resources are authenticated with either [personal or service access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens), or session cookies. Other authentication mechanisms are not supported. You can manage personal access tokens on your [Account settings](https://app.launchdarkly.com/settings/tokens) page. LaunchDarkly also has SDK keys, mobile keys, and client-side IDs that are used by our server-side SDKs, mobile SDKs, and client-side SDKs, respectively. **These keys cannot be used to access our REST API**. These keys are environment-specific, and can only perform read-only operations (fetching feature flag settings). | Auth mechanism | Allowed resources | Use cases | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------- | | [Personal access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens) | Can be customized on a per-token basis | Building scripts, custom integrations, data export | | SDK keys | Can only access read-only SDK-specific resources and the firehose, restricted to a single environment | Server-side SDKs, Firehose API | | Mobile keys | Can only access read-only mobile SDK-specific resources, restricted to a single environment | Mobile SDKs | | Client-side ID | Single environment, only flags marked available to client-side | Client-side JavaScript | > #### Keep your access tokens and SDK keys private > > Access tokens should _never_ be exposed in untrusted contexts. Never put an access token in client-side JavaScript, or embed it in a mobile application. LaunchDarkly has special mobile keys that you can embed in mobile apps. If you accidentally expose an access token or SDK key, you can reset it from your [Account Settings](https://app.launchdarkly.com/settings#/tokens) page. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ### Via request header The preferred way to authenticate with the API is by adding an `Authorization` header containing your access token to your requests. The value of the `Authorization` header must be your access token. Manage personal access tokens from the [Account Settings](https://app.launchdarkly.com/settings/tokens) page. ### Via session cookie For testing purposes, you can make API calls directly from your web browser. If you're logged in to the application, the API will use your existing session to authenticate calls. If you have a [role](https://docs.launchdarkly.com/home/team/built-in-roles) other than Admin, or have a [custom role](https://docs.launchdarkly.com/home/team/custom-roles) defined, you may not have permission to perform some API calls. You will receive a `401` response code in that case. > ### Modifying the Origin header causes an error > > LaunchDarkly validates that the Origin header for any API request authenticated by a session cookie matches the expected Origin header. The expected Origin header is `https://app.launchdarkly.com`. > > If the Origin header does not match what's expected, LaunchDarkly returns an error. This error can prevent the LaunchDarkly app from working correctly. > > Any browser extension that intentionally changes the Origin header can cause this problem. For example, the `Allow-Control-Allow-Origin: *` Chrome extension changes the Origin header to `http://evil.com` and causes the app to fail. > > To prevent this error, do not modify your Origin header. > > LaunchDarkly does not require origin matching when authenticating with an access token, so this issue does not affect normal API usage. ## Representations All resources expect and return JSON response bodies. Error responses will also send a JSON body. Read [Errors](#section/Errors) for a more detailed description of the error format used by the API. In practice this means that you always get a response with a `Content-Type` header set to `application/json`. In addition, request bodies for `PUT`, `POST`, `REPORT` and `PATCH` requests must be encoded as JSON with a `Content-Type` header set to `application/json`. ### Summary and detailed representations When you fetch a list of resources, the response includes only the most important attributes of each resource. This is a _summary representation_ of the resource. When you fetch an individual resource (for example, a single feature flag), you receive a _detailed representation_ containing all of the attributes of the resource. The best way to find a detailed representation is to follow links. Every summary representation includes a link to its detailed representation. ### Links and addressability The best way to navigate the API is by following links. These are attributes in representations that link to other resources. The API always uses the same format for links: - Links to other resources within the API are encapsulated in a `_links` object. - If the resource has a corresponding link to HTML content on the site, it is stored in a special `_site` link. Each link has two attributes: an href (the URL) and a type (the content type). For example, a feature resource might return the following: ```json { \"_links\": { \"parent\": { \"href\": \"/api/features\", \"type\": \"application/json\" }, \"self\": { \"href\": \"/api/features/sort.order\", \"type\": \"application/json\" } }, \"_site\": { \"href\": \"/features/sort.order\", \"type\": \"text/html\" } } ``` From this, you can navigate to the parent collection of features by following the `parent` link, or navigate to the site page for the feature by following the `_site` link. Collections are always represented as a JSON object with an `items` attribute containing an array of representations. Like all other representations, collections have `_links` defined at the top level. Paginated collections include `first`, `last`, `next`, and `prev` links containing a URL with the respective set of elements in the collection. ## Updates Resources that accept partial updates use the `PATCH` verb, and support the [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) format. Some resources also support the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) format. In addition, some resources support optional comments that can be submitted with updates. Comments appear in outgoing webhooks, the audit log, and other integrations. ### Updates via JSON Patch [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) is a way to specify the modifications to perform on a resource. For example, in this feature flag representation: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"description\": \"This is the description\", ... } ``` You can change the feature flag's description with the following patch document: ```json [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"This is the new description\" }] ``` JSON Patch documents are always arrays. You can specify multiple modifications to perform in a single request. You can also test that certain preconditions are met before applying the patch: ```json [ { \"op\": \"test\", \"path\": \"/version\", \"value\": 10 }, { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" } ] ``` The above patch request tests whether the feature flag's `version` is `10`, and if so, changes the feature flag's description. Attributes that aren't editable, like a resource's `_links`, have names that start with an underscore. ### Updates via JSON Merge Patch The API also supports the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) format, as well as the [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource. JSON Merge Patch is less expressive than JSON Patch but in many cases, it is simpler to construct a merge patch document. For example, you can change a feature flag's description with the following merge patch document: ```json { \"description\": \"New flag description\" } ``` ### Updates with comments You can submit optional comments with `PATCH` changes. The [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource supports comments. To submit a comment along with a JSON Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"patch\": [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" }] } ``` To submit a comment along with a JSON Merge Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"merge\": { \"description\": \"New flag description\" } } ``` ### Updates via semantic patches The API also supports the Semantic patch format. A semantic `PATCH` is a way to specify the modifications to perform on a resource as a set of executable instructions. JSON Patch uses paths and a limited set of operations to describe how to transform the current state of the resource into a new state. Semantic patch allows you to be explicit about intent using precise, custom instructions. In many cases, semantic patch instructions can also be defined independently of the current state of the resource. This can be useful when defining a change that may be applied at a future date. For example, in this feature flag configuration in environment Production: ```json { \"name\": \"Alternate sort order\", \"kind\": \"boolean\", \"key\": \"sort.order\", ... \"environments\": { \"production\": { \"on\": true, \"archived\": false, \"salt\": \"c29ydC5vcmRlcg==\", \"sel\": \"8de1085cb7354b0ab41c0e778376dfd3\", \"lastModified\": 1469131558260, \"version\": 81, \"targets\": [ { \"values\": [ \"Gerhard.Little@yahoo.com\" ], \"variation\": 0 }, { \"values\": [ \"1461797806429-33-861961230\", \"438580d8-02ee-418d-9eec-0085cab2bdf0\" ], \"variation\": 1 } ], \"rules\": [], \"fallthrough\": { \"variation\": 0 }, \"offVariation\": 1, \"prerequisites\": [], \"_site\": { \"href\": \"/default/production/features/sort.order\", \"type\": \"text/html\" } } } } ``` You can add a date you want a user to be removed from the feature flag's user targets. For example, “remove user 1461797806429-33-861961230 from the user target for variation 0 on the Alternate sort order flag in the production environment on Wed Jul 08 2020 at 15:27:41 pm”. This is done using the following: ```json { \"comment\": \"update expiring user targets\", \"instructions\": [ { \"kind\": \"removeExpireUserTargetDate\", \"userKey\": \"userKey\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\" }, { \"kind\": \"updateExpireUserTargetDate\", \"userKey\": \"userKey2\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1587582000000 }, { \"kind\": \"addExpireUserTargetDate\", \"userKey\": \"userKey3\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1594247266386 } ] } ``` Here is another example. In this feature flag configuration: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"environments\": { \"test\": { \"on\": true } } } ``` You can change the feature flag's description with the following patch document as a set of executable instructions. For example, “add user X to targets for variation Y and remove user A from targets for variation B for test flag”: ```json { \"comment\": \"\", \"instructions\": [ { \"kind\": \"removeUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"852cb784-54ff-46b9-8c35-5498d2e4f270\" }, { \"kind\": \"addUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"1bb18465-33b6-49aa-a3bd-eeb6650b33ad\" } ] } ``` > ### Supported semantic patch API endpoints > > - [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) > - [Update expiring user targets on feature flag](/tag/Feature-flags#operation/patchExpiringUserTargets) > - [Update expiring user target for flags](/tag/User-settings#operation/patchExpiringFlagsForUser) > - [Update expiring user targets on segment](/tag/Segments#operation/patchExpiringUserTargetsForSegment) ## Errors The API always returns errors in a common format. Here's an example: ```json { \"code\": \"invalid_request\", \"message\": \"A feature with that key already exists\", \"id\": \"30ce6058-87da-11e4-b116-123b93f75cba\" } ``` The general class of error is indicated by the `code`. The `message` is a human-readable explanation of what went wrong. The `id` is a unique identifier. Use it when you're working with LaunchDarkly support to debug a problem with a specific API call. ### HTTP Status - Error Response Codes | Code | Definition | Desc. | Possible Solution | | ---- | ----------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | 400 | Bad Request | A request that fails may return this HTTP response code. | Ensure JSON syntax in request body is correct. | | 401 | Unauthorized | User doesn't have permission to an API call. | Ensure your SDK key is good. | | 403 | Forbidden | User does not have permission for operation. | Ensure that the user or access token has proper permissions set. | | 409 | Conflict | The API request could not be completed because it conflicted with a concurrent API request. | Retry your request. | | 429 | Too many requests | See [Rate limiting](/#section/Rate-limiting). | Wait and try again later. | ## CORS The LaunchDarkly API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin. If an `Origin` header is given in a request, it will be echoed as an explicitly allowed origin. Otherwise, a wildcard is returned: `Access-Control-Allow-Origin: *`. For more information on CORS, see the [CORS W3C Recommendation](http://www.w3.org/TR/cors). Example CORS headers might look like: ```http Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, Authorization Access-Control-Allow-Methods: OPTIONS, GET, DELETE, PATCH Access-Control-Allow-Origin: * Access-Control-Max-Age: 300 ``` You can make authenticated CORS calls just as you would make same-origin calls, using either [token or session-based authentication](#section/Authentication). If you’re using session auth, you should set the `withCredentials` property for your `xhr` request to `true`. You should never expose your access tokens to untrusted users. ## Rate limiting We use several rate limiting strategies to ensure the availability of our APIs. Rate-limited calls to our APIs will return a `429` status code. Calls to our APIs will include headers indicating the current rate limit status. The specific headers returned depend on the API route being called. The limits differ based on the route, authentication mechanism, and other factors. Routes that are not rate limited may not contain any of the headers described below. > ### Rate limiting and SDKs > > LaunchDarkly SDKs are never rate limited and do not use the API endpoints defined here. LaunchDarkly uses a different set of approaches, including streaming/server-sent events and a global CDN, to ensure availability to the routes used by LaunchDarkly SDKs. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ### Global rate limits Authenticated requests are subject to a global limit. This is the maximum number of calls that can be made to the API per ten seconds. All personal access tokens on the account share this limit, so exceeding the limit with one access token will impact other tokens. Calls that are subject to global rate limits will return the headers below: | Header name | Description | | ------------------------------ | -------------------------------------------------------------------------------- | | `X-Ratelimit-Global-Remaining` | The maximum number of requests the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | We do not publicly document the specific number of calls that can be made globally. This limit may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limit. ### Route-level rate limits Some authenticated routes have custom rate limits. These also reset every ten seconds. Any access tokens hitting the same route share this limit, so exceeding the limit with one access token may impact other tokens. Calls that are subject to route-level rate limits will return the headers below: | Header name | Description | | ----------------------------- | ----------------------------------------------------------------------------------------------------- | | `X-Ratelimit-Route-Remaining` | The maximum number of requests to the current route the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | A _route_ represents a specific URL pattern and verb. For example, the [Delete environment](/tag/Environments#operation/deleteEnvironment) endpoint is considered a single route, and each call to delete an environment counts against your route-level rate limit for that route. We do not publicly document the specific number of calls that can be made to each endpoint per ten seconds. These limits may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limits. ### IP-based rate limiting We also employ IP-based rate limiting on some API routes. If you hit an IP-based rate limit, your API response will include a `Retry-After` header indicating how long to wait before re-trying the call. Clients must wait at least `Retry-After` seconds before making additional calls to our API, and should employ jitter and backoff strategies to avoid triggering rate limits again. ## OpenAPI (Swagger) We have a [complete OpenAPI (Swagger) specification](https://app.launchdarkly.com/api/v2/openapi.json) for our API. You can use this specification to generate client libraries to interact with our REST API in your language of choice. This specification is supported by several API-based tools such as Postman and Insomnia. In many cases, you can directly import our specification to ease use in navigating the APIs in the tooling. ## Client libraries We auto-generate multiple client libraries based on our OpenAPI specification. To learn more, visit [GitHub](https://github.com/search?q=topic%3Alaunchdarkly-api+org%3Alaunchdarkly&type=Repositories). ## Method Overriding Some firewalls and HTTP clients restrict the use of verbs other than `GET` and `POST`. In those environments, our API endpoints that use `PUT`, `PATCH`, and `DELETE` verbs will be inaccessible. To avoid this issue, our API supports the `X-HTTP-Method-Override` header, allowing clients to \"tunnel\" `PUT`, `PATCH`, and `DELETE` requests via a `POST` request. For example, if you wish to call one of our `PATCH` resources via a `POST` request, you can include `X-HTTP-Method-Override:PATCH` as a header. ## Beta resources We sometimes release new API resources in **beta** status before we release them with general availability. Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. We try to promote resources into general availability as quickly as possible. This happens after sufficient testing and when we're satisfied that we no longer need to make backwards-incompatible changes. We mark beta resources with a \"Beta\" callout in our documentation, pictured below: > ### This feature is in beta > > To use this feature, pass in a header including the `LD-API-Version` key with value set to `beta`. Use this header with each call. To learn more, read [Beta resources](/#section/Beta-resources). ### Using beta resources To use a beta resource, you must include a header in the request. If you call a beta resource without this header, you'll receive a `403` response. Use this header: ``` LD-API-Version: beta ``` ## Versioning We try hard to keep our REST API backwards compatible, but we occasionally have to make backwards-incompatible changes in the process of shipping new features. These breaking changes can cause unexpected behavior if you don't prepare for them accordingly. Updates to our REST API include support for the latest features in LaunchDarkly. We also release a new version of our REST API every time we make a breaking change. We provide simultaneous support for multiple API versions so you can migrate from your current API version to a new version at your own pace. ### Setting the API version per request You can set the API version on a specific request by sending an `LD-API-Version` header, as shown in the example below: ``` LD-API-Version: 20191212 ``` The header value is the version number of the API version you'd like to request. The number for each version corresponds to the date the version was released. In the example above the version `20191212` corresponds to December 12, 2019. ### Setting the API version per access token When creating an access token, you must specify a specific version of the API to use. This ensures that integrations using this token cannot be broken by version changes. Tokens created before versioning was released have their version set to `20160426` (the version of the API that existed before versioning) so that they continue working the same way they did before versioning. If you would like to upgrade your integration to use a new API version, you can explicitly set the header described above. > ### Best practice: Set the header for every client or integration > > We recommend that you set the API version header explicitly in any client or integration you build. > > Only rely on the access token API version during manual testing.
5
5
 
6
6
  The version of the OpenAPI document: 2.0
7
7
  Contact: support@launchdarkly.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.3.0-SNAPSHOT
9
+ OpenAPI Generator version: 5.3.0
10
10
 
11
11
  =end
12
12
 
@@ -302,7 +302,10 @@ module LaunchDarklyApi
302
302
  # HTTP header 'Accept' (if needed)
303
303
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
304
304
  # HTTP header 'Content-Type'
305
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
305
+ content_type = @api_client.select_header_content_type(['application/json'])
306
+ if !content_type.nil?
307
+ header_params['Content-Type'] = content_type
308
+ end
306
309
 
307
310
  # form parameters
308
311
  form_params = opts[:form_params] || {}
@@ -388,8 +391,13 @@ module LaunchDarklyApi
388
391
 
389
392
  # header parameters
390
393
  header_params = opts[:header_params] || {}
394
+ # HTTP header 'Accept' (if needed)
395
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
391
396
  # HTTP header 'Content-Type'
392
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
397
+ content_type = @api_client.select_header_content_type(['application/json'])
398
+ if !content_type.nil?
399
+ header_params['Content-Type'] = content_type
400
+ end
393
401
 
394
402
  # form parameters
395
403
  form_params = opts[:form_params] || {}
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #LaunchDarkly REST API
3
3
 
4
- ## Authentication All REST API resources are authenticated with either [personal or service access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens), or session cookies. Other authentication mechanisms are not supported. You can manage personal access tokens on your [Account settings](https://app.launchdarkly.com/settings/tokens) page. LaunchDarkly also has SDK keys, mobile keys, and client-side IDs that are used by our server-side SDKs, mobile SDKs, and client-side SDKs, respectively. **These keys cannot be used to access our REST API**. These keys are environment-specific, and can only perform read-only operations (fetching feature flag settings). | Auth mechanism | Allowed resources | Use cases | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------- | | [Personal access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens) | Can be customized on a per-token basis | Building scripts, custom integrations, data export | | SDK keys | Can only access read-only SDK-specific resources and the firehose, restricted to a single environment | Server-side SDKs, Firehose API | | Mobile keys | Can only access read-only mobile SDK-specific resources, restricted to a single environment | Mobile SDKs | | Client-side ID | Single environment, only flags marked available to client-side | Client-side JavaScript | > ### Keep your access tokens and SDK keys private > > Access tokens should _never_ be exposed in untrusted contexts. Never put an access token in client-side JavaScript, or embed it in a mobile application. LaunchDarkly has special mobile keys that you can embed in mobile apps. If you accidentally expose an access token or SDK key, you can reset it from your [Account Settings](https://app.launchdarkly.com/settings#/tokens) page. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ## Via request header The preferred way to authenticate with the API is by adding an `Authorization` header containing your access token to your requests. The value of the `Authorization` header must be your access token. Manage personal access tokens from the [Account Settings](https://app.launchdarkly.com/settings/tokens) page. ## Via session cookie For testing purposes, you can make API calls directly from your web browser. If you're logged in to the application, the API will use your existing session to authenticate calls. If you have a [role](https://docs.launchdarkly.com/home/team/built-in-roles) other than Admin, or have a [custom role](https://docs.launchdarkly.com/home/team/custom-roles) defined, you may not have permission to perform some API calls. You will receive a `401` response code in that case. > ### Modifying the Origin header causes an error > > LaunchDarkly validates that the Origin header for any API request authenticated by a session cookie matches the expected Origin header. The expected Origin header is `https://app.launchdarkly.com`. > > If the Origin header does not match what's expected, LaunchDarkly returns an error. This error can prevent the LaunchDarkly app from working correctly. > > Any browser extension that intentionally changes the Origin header can cause this problem. For example, the `Allow-Control-Allow-Origin: *` Chrome extension changes the Origin header to `http://evil.com` and causes the app to fail. > > To prevent this error, do not modify your Origin header. > > LaunchDarkly does not require origin matching when authenticating with an access token, so this issue does not affect normal API usage. # Representations All resources expect and return JSON response bodies. Error responses will also send a JSON body. Read [Errors](#section/Errors) for a more detailed description of the error format used by the API. In practice this means that you always get a response with a `Content-Type` header set to `application/json`. In addition, request bodies for `PUT`, `POST`, `REPORT` and `PATCH` requests must be encoded as JSON with a `Content-Type` header set to `application/json`. ## Summary and detailed representations When you fetch a list of resources, the response includes only the most important attributes of each resource. This is a _summary representation_ of the resource. When you fetch an individual resource (for example, a single feature flag), you receive a _detailed representation_ containing all of the attributes of the resource. The best way to find a detailed representation is to follow links. Every summary representation includes a link to its detailed representation. ## Links and addressability The best way to navigate the API is by following links. These are attributes in representations that link to other resources. The API always uses the same format for links: - Links to other resources within the API are encapsulated in a `_links` object. - If the resource has a corresponding link to HTML content on the site, it is stored in a special `_site` link. Each link has two attributes: an href (the URL) and a type (the content type). For example, a feature resource might return the following: ```json { \"_links\": { \"parent\": { \"href\": \"/api/features\", \"type\": \"application/json\" }, \"self\": { \"href\": \"/api/features/sort.order\", \"type\": \"application/json\" } }, \"_site\": { \"href\": \"/features/sort.order\", \"type\": \"text/html\" } } ``` From this, you can navigate to the parent collection of features by following the `parent` link, or navigate to the site page for the feature by following the `_site` link. Collections are always represented as a JSON object with an `items` attribute containing an array of representations. Like all other representations, collections have `_links` defined at the top level. Paginated collections include `first`, `last`, `next`, and `prev` links containing a URL with the respective set of elements in the collection. # Updates Resources that accept partial updates use the `PATCH` verb, and support the [JSON Patch](http://tools.ietf.org/html/rfc6902) format. Some resources also support the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) format. In addition, some resources support optional comments that can be submitted with updates. Comments appear in outgoing webhooks, the audit log, and other integrations. ## Updates via JSON Patch [JSON Patch](http://tools.ietf.org/html/rfc6902) is a way to specify the modifications to perform on a resource. For example, in this feature flag representation: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"description\": \"This is the description\", ... } ``` You can change the feature flag's description with the following patch document: ```json [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"This is the new description\" }] ``` JSON Patch documents are always arrays. You can specify multiple modifications to perform in a single request. You can also test that certain preconditions are met before applying the patch: ```json [ { \"op\": \"test\", \"path\": \"/version\", \"value\": 10 }, { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" } ] ``` The above patch request tests whether the feature flag's `version` is `10`, and if so, changes the feature flag's description. Attributes that aren't editable, like a resource's `_links`, have names that start with an underscore. ## Updates via JSON Merge Patch The API also supports the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) format, as well as the [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource. JSON Merge Patch is less expressive than JSON Patch but in many cases, it is simpler to construct a merge patch document. For example, you can change a feature flag's description with the following merge patch document: ```json { \"description\": \"New flag description\" } ``` ## Updates with comments You can submit optional comments with `PATCH` changes. The [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource supports comments. To submit a comment along with a JSON Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"patch\": [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" }] } ``` To submit a comment along with a JSON Merge Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"merge\": { \"description\": \"New flag description\" } } ``` ## Updates via semantic patches The API also supports the Semantic patch format. A semantic `PATCH` is a way to specify the modifications to perform on a resource as a set of executable instructions. JSON Patch uses paths and a limited set of operations to describe how to transform the current state of the resource into a new state. Semantic patch allows you to be explicit about intent using precise, custom instructions. In many cases, semantic patch instructions can also be defined independently of the current state of the resource. This can be useful when defining a change that may be applied at a future date. For example, in this feature flag configuration in environment Production: ```json { \"name\": \"Alternate sort order\", \"kind\": \"boolean\", \"key\": \"sort.order\", ... \"environments\": { \"production\": { \"on\": true, \"archived\": false, \"salt\": \"c29ydC5vcmRlcg==\", \"sel\": \"8de1085cb7354b0ab41c0e778376dfd3\", \"lastModified\": 1469131558260, \"version\": 81, \"targets\": [ { \"values\": [ \"Gerhard.Little@yahoo.com\" ], \"variation\": 0 }, { \"values\": [ \"1461797806429-33-861961230\", \"438580d8-02ee-418d-9eec-0085cab2bdf0\" ], \"variation\": 1 } ], \"rules\": [], \"fallthrough\": { \"variation\": 0 }, \"offVariation\": 1, \"prerequisites\": [], \"_site\": { \"href\": \"/default/production/features/sort.order\", \"type\": \"text/html\" } } } } ``` You can add a date you want a user to be removed from the feature flag's user targets. For example, “remove user 1461797806429-33-861961230 from the user target for variation 0 on the Alternate sort order flag in the production environment on Wed Jul 08 2020 at 15:27:41 pm”. This is done using the following: ```json { \"comment\": \"update expiring user targets\", \"instructions\": [ { \"kind\": \"removeExpireUserTargetDate\", \"userKey\": \"userKey\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\" }, { \"kind\": \"updateExpireUserTargetDate\", \"userKey\": \"userKey2\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1587582000000 }, { \"kind\": \"addExpireUserTargetDate\", \"userKey\": \"userKey3\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1594247266386 } ] } ``` Here is another example. In this feature flag configuration: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"environments\": { \"test\": { \"on\": true } } } ``` You can change the feature flag's description with the following patch document as a set of executable instructions. For example, “add user X to targets for variation Y and remove user A from targets for variation B for test flag”: ```json { \"comment\": \"\", \"instructions\": [ { \"kind\": \"removeUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"852cb784-54ff-46b9-8c35-5498d2e4f270\" }, { \"kind\": \"addUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"1bb18465-33b6-49aa-a3bd-eeb6650b33ad\" } ] } ``` > ### Supported semantic patch API endpoints > > - [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) > - [Update expiring user targets on feature flag](/tag/Feature-flags#operation/patchExpiringUserTargets) > - [Update expiring user target for flags](/tag/User-Settings#operation/patchExpiringFlagsForUser) > - [Update expiring user targets on segment](/tag/Segments#operation/patchExpiringUserTargetsOnSegment) # Errors The API always returns errors in a common format. Here's an example: ```json { \"code\": \"invalid_request\", \"message\": \"A feature with that key already exists\", \"id\": \"30ce6058-87da-11e4-b116-123b93f75cba\" } ``` The general class of error is indicated by the `code`. The `message` is a human-readable explanation of what went wrong. The `id` is a unique identifier. Use it when you're working with LaunchDarkly support to debug a problem with a specific API call. ## HTTP Status - Error Response Codes | Code | Definition | Desc. | Possible Solution | | ---- | ----------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | 400 | Bad Request | A request that fails may return this HTTP response code. | Ensure JSON syntax in request body is correct. | | 401 | Unauthorized | User doesn't have permission to an API call. | Ensure your SDK key is good. | | 403 | Forbidden | User does not have permission for operation. | Ensure that the user or access token has proper permissions set. | | 409 | Conflict | The API request could not be completed because it conflicted with a concurrent API request. | Retry your request. | | 429 | Too many requests | See [Rate limiting](/#section/Rate-limiting). | Wait and try again later. | # CORS The LaunchDarkly API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin. If an `Origin` header is given in a request, it will be echoed as an explicitly allowed origin. Otherwise, a wildcard is returned: `Access-Control-Allow-Origin: *`. For more information on CORS, see the [CORS W3C Recommendation](http://www.w3.org/TR/cors). Example CORS headers might look like: ```http Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, Authorization Access-Control-Allow-Methods: OPTIONS, GET, DELETE, PATCH Access-Control-Allow-Origin: * Access-Control-Max-Age: 300 ``` You can make authenticated CORS calls just as you would make same-origin calls, using either [token or session-based authentication](#section/Authentication). If you’re using session auth, you should set the `withCredentials` property for your `xhr` request to `true`. You should never expose your access tokens to untrusted users. # Rate limiting We use several rate limiting strategies to ensure the availability of our APIs. Rate-limited calls to our APIs will return a `429` status code. Calls to our APIs will include headers indicating the current rate limit status. The specific headers returned depend on the API route being called. The limits differ based on the route, authentication mechanism, and other factors. Routes that are not rate limited may not contain any of the headers described below. > ### Rate limiting and SDKs > > LaunchDarkly SDKs are never rate limited and do not use the API endpoints defined here. LaunchDarkly uses a different set of approaches, including streaming/server-sent events and a global CDN, to ensure availability to the routes used by LaunchDarkly SDKs. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ## Global rate limits Authenticated requests are subject to a global limit. This is the maximum number of calls that can be made to the API per ten seconds. All personal access tokens on the account share this limit, so exceeding the limit with one access token will impact other tokens. Calls that are subject to global rate limits will return the headers below: | Header name | Description | | ------------------------------ | -------------------------------------------------------------------------------- | | `X-Ratelimit-Global-Remaining` | The maximum number of requests the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | We do not publicly document the specific number of calls that can be made globally. This limit may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limit. ## Route-level rate limits Some authenticated routes have custom rate limits. These also reset every ten seconds. Any access tokens hitting the same route share this limit, so exceeding the limit with one access token may impact other tokens. Calls that are subject to route-level rate limits will return the headers below: | Header name | Description | | ----------------------------- | ----------------------------------------------------------------------------------------------------- | | `X-Ratelimit-Route-Remaining` | The maximum number of requests to the current route the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | A _route_ represents a specific URL pattern and verb. For example, the [Delete environment](/tag/Environments#operation/deleteEnvironment) endpoint is considered a single route, and each call to delete an environment counts against your route-level rate limit for that route. We do not publicly document the specific number of calls that can be made to each endpoint per ten seconds. These limits may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limits. ## IP-based rate limiting We also employ IP-based rate limiting on some API routes. If you hit an IP-based rate limit, your API response will include a `Retry-After` header indicating how long to wait before re-trying the call. Clients must wait at least `Retry-After` seconds before making additional calls to our API, and should employ jitter and backoff strategies to avoid triggering rate limits again. # OpenAPI (Swagger) We have a [complete OpenAPI (Swagger) specification](https://app.launchdarkly.com/api/v2/openapi.json) for our API. You can use this specification to generate client libraries to interact with our REST API in your language of choice. This specification is supported by several API-based tools such as Postman and Insomnia. In many cases, you can directly import our specification to ease use in navigating the APIs in the tooling. # Client libraries We auto-generate multiple client libraries based on our OpenAPI specification. To learn more, visit [GitHub](https://github.com/search?q=topic%3Alaunchdarkly-api+org%3Alaunchdarkly&type=Repositories). # Method Overriding Some firewalls and HTTP clients restrict the use of verbs other than `GET` and `POST`. In those environments, our API endpoints that use `PUT`, `PATCH`, and `DELETE` verbs will be inaccessible. To avoid this issue, our API supports the `X-HTTP-Method-Override` header, allowing clients to \"tunnel\" `PUT`, `PATCH`, and `DELETE` requests via a `POST` request. For example, if you wish to call one of our `PATCH` resources via a `POST` request, you can include `X-HTTP-Method-Override:PATCH` as a header. # Beta resources We sometimes release new API resources in **beta** status before we release them with general availability. Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. We try to promote resources into general availability as quickly as possible. This happens after sufficient testing and when we're satisfied that we no longer need to make backwards-incompatible changes. We mark beta resources with a \"Beta\" callout in our documentation, pictured below: > ### This feature is in beta > > To use this feature, pass in a header including the `LD-API-Version` key with value set to `beta`. Use this header with each call. To learn more, read [Beta resources](/#section/Beta-resources). ## Using beta resources To use a beta resource, you must include a header in the request. If you call a beta resource without this header, you'll receive a `403` response. Use this header: ``` LD-API-Version: beta ``` # Versioning We try hard to keep our REST API backwards compatible, but we occasionally have to make backwards-incompatible changes in the process of shipping new features. These breaking changes can cause unexpected behavior if you don't prepare for them accordingly. Updates to our REST API include support for the latest features in LaunchDarkly. We also release a new version of our REST API every time we make a breaking change. We provide simultaneous support for multiple API versions so you can migrate from your current API version to a new version at your own pace. ## Setting the API version per request You can set the API version on a specific request by sending an `LD-API-Version` header, as shown in the example below: ``` LD-API-Version: 20191212 ``` The header value is the version number of the API version you'd like to request. The number for each version corresponds to the date the version was released. In the example above the version `20191212` corresponds to December 12, 2019. ## Setting the API version per access token When creating an access token, you must specify a specific version of the API to use. This ensures that integrations using this token cannot be broken by version changes. Tokens created before versioning was released have their version set to `20160426` (the version of the API that existed before versioning) so that they continue working the same way they did before versioning. If you would like to upgrade your integration to use a new API version, you can explicitly set the header described above. > ### Best practice: Set the header for every client or integration > > We recommend that you set the API version header explicitly in any client or integration you build. > > Only rely on the access token API version during manual testing.
4
+ ## Overview ## Authentication All REST API resources are authenticated with either [personal or service access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens), or session cookies. Other authentication mechanisms are not supported. You can manage personal access tokens on your [Account settings](https://app.launchdarkly.com/settings/tokens) page. LaunchDarkly also has SDK keys, mobile keys, and client-side IDs that are used by our server-side SDKs, mobile SDKs, and client-side SDKs, respectively. **These keys cannot be used to access our REST API**. These keys are environment-specific, and can only perform read-only operations (fetching feature flag settings). | Auth mechanism | Allowed resources | Use cases | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------- | | [Personal access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens) | Can be customized on a per-token basis | Building scripts, custom integrations, data export | | SDK keys | Can only access read-only SDK-specific resources and the firehose, restricted to a single environment | Server-side SDKs, Firehose API | | Mobile keys | Can only access read-only mobile SDK-specific resources, restricted to a single environment | Mobile SDKs | | Client-side ID | Single environment, only flags marked available to client-side | Client-side JavaScript | > #### Keep your access tokens and SDK keys private > > Access tokens should _never_ be exposed in untrusted contexts. Never put an access token in client-side JavaScript, or embed it in a mobile application. LaunchDarkly has special mobile keys that you can embed in mobile apps. If you accidentally expose an access token or SDK key, you can reset it from your [Account Settings](https://app.launchdarkly.com/settings#/tokens) page. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ### Via request header The preferred way to authenticate with the API is by adding an `Authorization` header containing your access token to your requests. The value of the `Authorization` header must be your access token. Manage personal access tokens from the [Account Settings](https://app.launchdarkly.com/settings/tokens) page. ### Via session cookie For testing purposes, you can make API calls directly from your web browser. If you're logged in to the application, the API will use your existing session to authenticate calls. If you have a [role](https://docs.launchdarkly.com/home/team/built-in-roles) other than Admin, or have a [custom role](https://docs.launchdarkly.com/home/team/custom-roles) defined, you may not have permission to perform some API calls. You will receive a `401` response code in that case. > ### Modifying the Origin header causes an error > > LaunchDarkly validates that the Origin header for any API request authenticated by a session cookie matches the expected Origin header. The expected Origin header is `https://app.launchdarkly.com`. > > If the Origin header does not match what's expected, LaunchDarkly returns an error. This error can prevent the LaunchDarkly app from working correctly. > > Any browser extension that intentionally changes the Origin header can cause this problem. For example, the `Allow-Control-Allow-Origin: *` Chrome extension changes the Origin header to `http://evil.com` and causes the app to fail. > > To prevent this error, do not modify your Origin header. > > LaunchDarkly does not require origin matching when authenticating with an access token, so this issue does not affect normal API usage. ## Representations All resources expect and return JSON response bodies. Error responses will also send a JSON body. Read [Errors](#section/Errors) for a more detailed description of the error format used by the API. In practice this means that you always get a response with a `Content-Type` header set to `application/json`. In addition, request bodies for `PUT`, `POST`, `REPORT` and `PATCH` requests must be encoded as JSON with a `Content-Type` header set to `application/json`. ### Summary and detailed representations When you fetch a list of resources, the response includes only the most important attributes of each resource. This is a _summary representation_ of the resource. When you fetch an individual resource (for example, a single feature flag), you receive a _detailed representation_ containing all of the attributes of the resource. The best way to find a detailed representation is to follow links. Every summary representation includes a link to its detailed representation. ### Links and addressability The best way to navigate the API is by following links. These are attributes in representations that link to other resources. The API always uses the same format for links: - Links to other resources within the API are encapsulated in a `_links` object. - If the resource has a corresponding link to HTML content on the site, it is stored in a special `_site` link. Each link has two attributes: an href (the URL) and a type (the content type). For example, a feature resource might return the following: ```json { \"_links\": { \"parent\": { \"href\": \"/api/features\", \"type\": \"application/json\" }, \"self\": { \"href\": \"/api/features/sort.order\", \"type\": \"application/json\" } }, \"_site\": { \"href\": \"/features/sort.order\", \"type\": \"text/html\" } } ``` From this, you can navigate to the parent collection of features by following the `parent` link, or navigate to the site page for the feature by following the `_site` link. Collections are always represented as a JSON object with an `items` attribute containing an array of representations. Like all other representations, collections have `_links` defined at the top level. Paginated collections include `first`, `last`, `next`, and `prev` links containing a URL with the respective set of elements in the collection. ## Updates Resources that accept partial updates use the `PATCH` verb, and support the [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) format. Some resources also support the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) format. In addition, some resources support optional comments that can be submitted with updates. Comments appear in outgoing webhooks, the audit log, and other integrations. ### Updates via JSON Patch [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) is a way to specify the modifications to perform on a resource. For example, in this feature flag representation: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"description\": \"This is the description\", ... } ``` You can change the feature flag's description with the following patch document: ```json [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"This is the new description\" }] ``` JSON Patch documents are always arrays. You can specify multiple modifications to perform in a single request. You can also test that certain preconditions are met before applying the patch: ```json [ { \"op\": \"test\", \"path\": \"/version\", \"value\": 10 }, { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" } ] ``` The above patch request tests whether the feature flag's `version` is `10`, and if so, changes the feature flag's description. Attributes that aren't editable, like a resource's `_links`, have names that start with an underscore. ### Updates via JSON Merge Patch The API also supports the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) format, as well as the [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource. JSON Merge Patch is less expressive than JSON Patch but in many cases, it is simpler to construct a merge patch document. For example, you can change a feature flag's description with the following merge patch document: ```json { \"description\": \"New flag description\" } ``` ### Updates with comments You can submit optional comments with `PATCH` changes. The [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource supports comments. To submit a comment along with a JSON Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"patch\": [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" }] } ``` To submit a comment along with a JSON Merge Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"merge\": { \"description\": \"New flag description\" } } ``` ### Updates via semantic patches The API also supports the Semantic patch format. A semantic `PATCH` is a way to specify the modifications to perform on a resource as a set of executable instructions. JSON Patch uses paths and a limited set of operations to describe how to transform the current state of the resource into a new state. Semantic patch allows you to be explicit about intent using precise, custom instructions. In many cases, semantic patch instructions can also be defined independently of the current state of the resource. This can be useful when defining a change that may be applied at a future date. For example, in this feature flag configuration in environment Production: ```json { \"name\": \"Alternate sort order\", \"kind\": \"boolean\", \"key\": \"sort.order\", ... \"environments\": { \"production\": { \"on\": true, \"archived\": false, \"salt\": \"c29ydC5vcmRlcg==\", \"sel\": \"8de1085cb7354b0ab41c0e778376dfd3\", \"lastModified\": 1469131558260, \"version\": 81, \"targets\": [ { \"values\": [ \"Gerhard.Little@yahoo.com\" ], \"variation\": 0 }, { \"values\": [ \"1461797806429-33-861961230\", \"438580d8-02ee-418d-9eec-0085cab2bdf0\" ], \"variation\": 1 } ], \"rules\": [], \"fallthrough\": { \"variation\": 0 }, \"offVariation\": 1, \"prerequisites\": [], \"_site\": { \"href\": \"/default/production/features/sort.order\", \"type\": \"text/html\" } } } } ``` You can add a date you want a user to be removed from the feature flag's user targets. For example, “remove user 1461797806429-33-861961230 from the user target for variation 0 on the Alternate sort order flag in the production environment on Wed Jul 08 2020 at 15:27:41 pm”. This is done using the following: ```json { \"comment\": \"update expiring user targets\", \"instructions\": [ { \"kind\": \"removeExpireUserTargetDate\", \"userKey\": \"userKey\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\" }, { \"kind\": \"updateExpireUserTargetDate\", \"userKey\": \"userKey2\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1587582000000 }, { \"kind\": \"addExpireUserTargetDate\", \"userKey\": \"userKey3\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1594247266386 } ] } ``` Here is another example. In this feature flag configuration: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"environments\": { \"test\": { \"on\": true } } } ``` You can change the feature flag's description with the following patch document as a set of executable instructions. For example, “add user X to targets for variation Y and remove user A from targets for variation B for test flag”: ```json { \"comment\": \"\", \"instructions\": [ { \"kind\": \"removeUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"852cb784-54ff-46b9-8c35-5498d2e4f270\" }, { \"kind\": \"addUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"1bb18465-33b6-49aa-a3bd-eeb6650b33ad\" } ] } ``` > ### Supported semantic patch API endpoints > > - [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) > - [Update expiring user targets on feature flag](/tag/Feature-flags#operation/patchExpiringUserTargets) > - [Update expiring user target for flags](/tag/User-settings#operation/patchExpiringFlagsForUser) > - [Update expiring user targets on segment](/tag/Segments#operation/patchExpiringUserTargetsForSegment) ## Errors The API always returns errors in a common format. Here's an example: ```json { \"code\": \"invalid_request\", \"message\": \"A feature with that key already exists\", \"id\": \"30ce6058-87da-11e4-b116-123b93f75cba\" } ``` The general class of error is indicated by the `code`. The `message` is a human-readable explanation of what went wrong. The `id` is a unique identifier. Use it when you're working with LaunchDarkly support to debug a problem with a specific API call. ### HTTP Status - Error Response Codes | Code | Definition | Desc. | Possible Solution | | ---- | ----------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | 400 | Bad Request | A request that fails may return this HTTP response code. | Ensure JSON syntax in request body is correct. | | 401 | Unauthorized | User doesn't have permission to an API call. | Ensure your SDK key is good. | | 403 | Forbidden | User does not have permission for operation. | Ensure that the user or access token has proper permissions set. | | 409 | Conflict | The API request could not be completed because it conflicted with a concurrent API request. | Retry your request. | | 429 | Too many requests | See [Rate limiting](/#section/Rate-limiting). | Wait and try again later. | ## CORS The LaunchDarkly API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin. If an `Origin` header is given in a request, it will be echoed as an explicitly allowed origin. Otherwise, a wildcard is returned: `Access-Control-Allow-Origin: *`. For more information on CORS, see the [CORS W3C Recommendation](http://www.w3.org/TR/cors). Example CORS headers might look like: ```http Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, Authorization Access-Control-Allow-Methods: OPTIONS, GET, DELETE, PATCH Access-Control-Allow-Origin: * Access-Control-Max-Age: 300 ``` You can make authenticated CORS calls just as you would make same-origin calls, using either [token or session-based authentication](#section/Authentication). If you’re using session auth, you should set the `withCredentials` property for your `xhr` request to `true`. You should never expose your access tokens to untrusted users. ## Rate limiting We use several rate limiting strategies to ensure the availability of our APIs. Rate-limited calls to our APIs will return a `429` status code. Calls to our APIs will include headers indicating the current rate limit status. The specific headers returned depend on the API route being called. The limits differ based on the route, authentication mechanism, and other factors. Routes that are not rate limited may not contain any of the headers described below. > ### Rate limiting and SDKs > > LaunchDarkly SDKs are never rate limited and do not use the API endpoints defined here. LaunchDarkly uses a different set of approaches, including streaming/server-sent events and a global CDN, to ensure availability to the routes used by LaunchDarkly SDKs. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ### Global rate limits Authenticated requests are subject to a global limit. This is the maximum number of calls that can be made to the API per ten seconds. All personal access tokens on the account share this limit, so exceeding the limit with one access token will impact other tokens. Calls that are subject to global rate limits will return the headers below: | Header name | Description | | ------------------------------ | -------------------------------------------------------------------------------- | | `X-Ratelimit-Global-Remaining` | The maximum number of requests the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | We do not publicly document the specific number of calls that can be made globally. This limit may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limit. ### Route-level rate limits Some authenticated routes have custom rate limits. These also reset every ten seconds. Any access tokens hitting the same route share this limit, so exceeding the limit with one access token may impact other tokens. Calls that are subject to route-level rate limits will return the headers below: | Header name | Description | | ----------------------------- | ----------------------------------------------------------------------------------------------------- | | `X-Ratelimit-Route-Remaining` | The maximum number of requests to the current route the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | A _route_ represents a specific URL pattern and verb. For example, the [Delete environment](/tag/Environments#operation/deleteEnvironment) endpoint is considered a single route, and each call to delete an environment counts against your route-level rate limit for that route. We do not publicly document the specific number of calls that can be made to each endpoint per ten seconds. These limits may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limits. ### IP-based rate limiting We also employ IP-based rate limiting on some API routes. If you hit an IP-based rate limit, your API response will include a `Retry-After` header indicating how long to wait before re-trying the call. Clients must wait at least `Retry-After` seconds before making additional calls to our API, and should employ jitter and backoff strategies to avoid triggering rate limits again. ## OpenAPI (Swagger) We have a [complete OpenAPI (Swagger) specification](https://app.launchdarkly.com/api/v2/openapi.json) for our API. You can use this specification to generate client libraries to interact with our REST API in your language of choice. This specification is supported by several API-based tools such as Postman and Insomnia. In many cases, you can directly import our specification to ease use in navigating the APIs in the tooling. ## Client libraries We auto-generate multiple client libraries based on our OpenAPI specification. To learn more, visit [GitHub](https://github.com/search?q=topic%3Alaunchdarkly-api+org%3Alaunchdarkly&type=Repositories). ## Method Overriding Some firewalls and HTTP clients restrict the use of verbs other than `GET` and `POST`. In those environments, our API endpoints that use `PUT`, `PATCH`, and `DELETE` verbs will be inaccessible. To avoid this issue, our API supports the `X-HTTP-Method-Override` header, allowing clients to \"tunnel\" `PUT`, `PATCH`, and `DELETE` requests via a `POST` request. For example, if you wish to call one of our `PATCH` resources via a `POST` request, you can include `X-HTTP-Method-Override:PATCH` as a header. ## Beta resources We sometimes release new API resources in **beta** status before we release them with general availability. Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. We try to promote resources into general availability as quickly as possible. This happens after sufficient testing and when we're satisfied that we no longer need to make backwards-incompatible changes. We mark beta resources with a \"Beta\" callout in our documentation, pictured below: > ### This feature is in beta > > To use this feature, pass in a header including the `LD-API-Version` key with value set to `beta`. Use this header with each call. To learn more, read [Beta resources](/#section/Beta-resources). ### Using beta resources To use a beta resource, you must include a header in the request. If you call a beta resource without this header, you'll receive a `403` response. Use this header: ``` LD-API-Version: beta ``` ## Versioning We try hard to keep our REST API backwards compatible, but we occasionally have to make backwards-incompatible changes in the process of shipping new features. These breaking changes can cause unexpected behavior if you don't prepare for them accordingly. Updates to our REST API include support for the latest features in LaunchDarkly. We also release a new version of our REST API every time we make a breaking change. We provide simultaneous support for multiple API versions so you can migrate from your current API version to a new version at your own pace. ### Setting the API version per request You can set the API version on a specific request by sending an `LD-API-Version` header, as shown in the example below: ``` LD-API-Version: 20191212 ``` The header value is the version number of the API version you'd like to request. The number for each version corresponds to the date the version was released. In the example above the version `20191212` corresponds to December 12, 2019. ### Setting the API version per access token When creating an access token, you must specify a specific version of the API to use. This ensures that integrations using this token cannot be broken by version changes. Tokens created before versioning was released have their version set to `20160426` (the version of the API that existed before versioning) so that they continue working the same way they did before versioning. If you would like to upgrade your integration to use a new API version, you can explicitly set the header described above. > ### Best practice: Set the header for every client or integration > > We recommend that you set the API version header explicitly in any client or integration you build. > > Only rely on the access token API version during manual testing.
5
5
 
6
6
  The version of the OpenAPI document: 2.0
7
7
  Contact: support@launchdarkly.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.3.0-SNAPSHOT
9
+ OpenAPI Generator version: 5.3.0
10
10
 
11
11
  =end
12
12
 
@@ -62,6 +62,8 @@ module LaunchDarklyApi
62
62
 
63
63
  # header parameters
64
64
  header_params = opts[:header_params] || {}
65
+ # HTTP header 'Accept' (if needed)
66
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
65
67
 
66
68
  # form parameters
67
69
  form_params = opts[:form_params] || {}
@@ -93,7 +95,7 @@ module LaunchDarklyApi
93
95
  end
94
96
 
95
97
  # Find users
96
- # Search users in LaunchDarkly based on their last active date, or a search query. Do not use to enumerate all users in LaunchDarkly. Instead use the [List users](getUsers) API resource. > ### `offset` is deprecated > > `offset` is deprecated and will be removed in a future API version. You can still use `offset` and `limit` for pagination, but we recommend you use `sort` and `searchAfter` instead. `searchAfter` allows you to page through more than 10,000 users, but `offset` and `limit` do not.
98
+ # Search users in LaunchDarkly based on their last active date, a user attribute filter set, or a search query. Do not use to list all users in LaunchDarkly. Instead, use the [List users](getUsers) API resource. An example user attribute filter set is `filter=firstName:Anna,activeTrial:false`. This matches users that have the user attribute `firstName` set to `Anna`, that also have the attribute `activeTrial` set to `false`. > ### `offset` is deprecated > > `offset` is deprecated and will be removed in a future API version. You can still use `offset` and `limit` for pagination, but we recommend you use `sort` and `searchAfter` instead. `searchAfter` allows you to page through more than 10,000 users, but `offset` and `limit` do not.
97
99
  # @param proj_key [String] The project key
98
100
  # @param env_key [String] The environment key
99
101
  # @param [Hash] opts the optional parameters
@@ -101,7 +103,9 @@ module LaunchDarklyApi
101
103
  # @option opts [Integer] :limit Specifies the maximum number of items in the collection to return (max: 50, default: 20)
102
104
  # @option opts [Integer] :offset Specifies the first item to return in the collection
103
105
  # @option opts [Integer] :after A unix epoch time in milliseconds specifying the maximum last time a user requested a feature flag from LaunchDarkly
106
+ # @option opts [String] :sort Specifies a field by which to sort. LaunchDarkly supports the `userKey` and `lastSeen` fields. Fields prefixed by a dash ( - ) sort in descending order.
104
107
  # @option opts [String] :search_after Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead.
108
+ # @option opts [String] :filter A comma-separated list of user attribute filters. Each filter is in the form of attributeKey:attributeValue
105
109
  # @return [Users]
106
110
  def get_search_users(proj_key, env_key, opts = {})
107
111
  data, _status_code, _headers = get_search_users_with_http_info(proj_key, env_key, opts)
@@ -109,7 +113,7 @@ module LaunchDarklyApi
109
113
  end
110
114
 
111
115
  # Find users
112
- # Search users in LaunchDarkly based on their last active date, or a search query. Do not use to enumerate all users in LaunchDarkly. Instead use the [List users](getUsers) API resource. > ### `offset` is deprecated > > `offset` is deprecated and will be removed in a future API version. You can still use `offset` and `limit` for pagination, but we recommend you use `sort` and `searchAfter` instead. `searchAfter` allows you to page through more than 10,000 users, but `offset` and `limit` do not.
116
+ # Search users in LaunchDarkly based on their last active date, a user attribute filter set, or a search query. Do not use to list all users in LaunchDarkly. Instead, use the [List users](getUsers) API resource. An example user attribute filter set is `filter=firstName:Anna,activeTrial:false`. This matches users that have the user attribute `firstName` set to `Anna`, that also have the attribute `activeTrial` set to `false`. > ### `offset` is deprecated > > `offset` is deprecated and will be removed in a future API version. You can still use `offset` and `limit` for pagination, but we recommend you use `sort` and `searchAfter` instead. `searchAfter` allows you to page through more than 10,000 users, but `offset` and `limit` do not.
113
117
  # @param proj_key [String] The project key
114
118
  # @param env_key [String] The environment key
115
119
  # @param [Hash] opts the optional parameters
@@ -117,7 +121,9 @@ module LaunchDarklyApi
117
121
  # @option opts [Integer] :limit Specifies the maximum number of items in the collection to return (max: 50, default: 20)
118
122
  # @option opts [Integer] :offset Specifies the first item to return in the collection
119
123
  # @option opts [Integer] :after A unix epoch time in milliseconds specifying the maximum last time a user requested a feature flag from LaunchDarkly
124
+ # @option opts [String] :sort Specifies a field by which to sort. LaunchDarkly supports the `userKey` and `lastSeen` fields. Fields prefixed by a dash ( - ) sort in descending order.
120
125
  # @option opts [String] :search_after Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead.
126
+ # @option opts [String] :filter A comma-separated list of user attribute filters. Each filter is in the form of attributeKey:attributeValue
121
127
  # @return [Array<(Users, Integer, Hash)>] Users data, response status code and response headers
122
128
  def get_search_users_with_http_info(proj_key, env_key, opts = {})
123
129
  if @api_client.config.debugging
@@ -140,7 +146,9 @@ module LaunchDarklyApi
140
146
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
141
147
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
142
148
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
149
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
143
150
  query_params[:'searchAfter'] = opts[:'search_after'] if !opts[:'search_after'].nil?
151
+ query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
144
152
 
145
153
  # header parameters
146
154
  header_params = opts[:header_params] || {}
@@ -182,7 +190,7 @@ module LaunchDarklyApi
182
190
  # @param env_key [String] The environment key
183
191
  # @param key [String] The user key
184
192
  # @param [Hash] opts the optional parameters
185
- # @return [User]
193
+ # @return [UserRecord]
186
194
  def get_user(proj_key, env_key, key, opts = {})
187
195
  data, _status_code, _headers = get_user_with_http_info(proj_key, env_key, key, opts)
188
196
  data
@@ -194,7 +202,7 @@ module LaunchDarklyApi
194
202
  # @param env_key [String] The environment key
195
203
  # @param key [String] The user key
196
204
  # @param [Hash] opts the optional parameters
197
- # @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
205
+ # @return [Array<(UserRecord, Integer, Hash)>] UserRecord data, response status code and response headers
198
206
  def get_user_with_http_info(proj_key, env_key, key, opts = {})
199
207
  if @api_client.config.debugging
200
208
  @api_client.config.logger.debug 'Calling API: UsersApi.get_user ...'
@@ -229,7 +237,7 @@ module LaunchDarklyApi
229
237
  post_body = opts[:debug_body]
230
238
 
231
239
  # return_type
232
- return_type = opts[:debug_return_type] || 'User'
240
+ return_type = opts[:debug_return_type] || 'UserRecord'
233
241
 
234
242
  # auth_names
235
243
  auth_names = opts[:debug_auth_names] || ['ApiKey']
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #LaunchDarkly REST API
3
3
 
4
- ## Authentication All REST API resources are authenticated with either [personal or service access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens), or session cookies. Other authentication mechanisms are not supported. You can manage personal access tokens on your [Account settings](https://app.launchdarkly.com/settings/tokens) page. LaunchDarkly also has SDK keys, mobile keys, and client-side IDs that are used by our server-side SDKs, mobile SDKs, and client-side SDKs, respectively. **These keys cannot be used to access our REST API**. These keys are environment-specific, and can only perform read-only operations (fetching feature flag settings). | Auth mechanism | Allowed resources | Use cases | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------- | | [Personal access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens) | Can be customized on a per-token basis | Building scripts, custom integrations, data export | | SDK keys | Can only access read-only SDK-specific resources and the firehose, restricted to a single environment | Server-side SDKs, Firehose API | | Mobile keys | Can only access read-only mobile SDK-specific resources, restricted to a single environment | Mobile SDKs | | Client-side ID | Single environment, only flags marked available to client-side | Client-side JavaScript | > ### Keep your access tokens and SDK keys private > > Access tokens should _never_ be exposed in untrusted contexts. Never put an access token in client-side JavaScript, or embed it in a mobile application. LaunchDarkly has special mobile keys that you can embed in mobile apps. If you accidentally expose an access token or SDK key, you can reset it from your [Account Settings](https://app.launchdarkly.com/settings#/tokens) page. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ## Via request header The preferred way to authenticate with the API is by adding an `Authorization` header containing your access token to your requests. The value of the `Authorization` header must be your access token. Manage personal access tokens from the [Account Settings](https://app.launchdarkly.com/settings/tokens) page. ## Via session cookie For testing purposes, you can make API calls directly from your web browser. If you're logged in to the application, the API will use your existing session to authenticate calls. If you have a [role](https://docs.launchdarkly.com/home/team/built-in-roles) other than Admin, or have a [custom role](https://docs.launchdarkly.com/home/team/custom-roles) defined, you may not have permission to perform some API calls. You will receive a `401` response code in that case. > ### Modifying the Origin header causes an error > > LaunchDarkly validates that the Origin header for any API request authenticated by a session cookie matches the expected Origin header. The expected Origin header is `https://app.launchdarkly.com`. > > If the Origin header does not match what's expected, LaunchDarkly returns an error. This error can prevent the LaunchDarkly app from working correctly. > > Any browser extension that intentionally changes the Origin header can cause this problem. For example, the `Allow-Control-Allow-Origin: *` Chrome extension changes the Origin header to `http://evil.com` and causes the app to fail. > > To prevent this error, do not modify your Origin header. > > LaunchDarkly does not require origin matching when authenticating with an access token, so this issue does not affect normal API usage. # Representations All resources expect and return JSON response bodies. Error responses will also send a JSON body. Read [Errors](#section/Errors) for a more detailed description of the error format used by the API. In practice this means that you always get a response with a `Content-Type` header set to `application/json`. In addition, request bodies for `PUT`, `POST`, `REPORT` and `PATCH` requests must be encoded as JSON with a `Content-Type` header set to `application/json`. ## Summary and detailed representations When you fetch a list of resources, the response includes only the most important attributes of each resource. This is a _summary representation_ of the resource. When you fetch an individual resource (for example, a single feature flag), you receive a _detailed representation_ containing all of the attributes of the resource. The best way to find a detailed representation is to follow links. Every summary representation includes a link to its detailed representation. ## Links and addressability The best way to navigate the API is by following links. These are attributes in representations that link to other resources. The API always uses the same format for links: - Links to other resources within the API are encapsulated in a `_links` object. - If the resource has a corresponding link to HTML content on the site, it is stored in a special `_site` link. Each link has two attributes: an href (the URL) and a type (the content type). For example, a feature resource might return the following: ```json { \"_links\": { \"parent\": { \"href\": \"/api/features\", \"type\": \"application/json\" }, \"self\": { \"href\": \"/api/features/sort.order\", \"type\": \"application/json\" } }, \"_site\": { \"href\": \"/features/sort.order\", \"type\": \"text/html\" } } ``` From this, you can navigate to the parent collection of features by following the `parent` link, or navigate to the site page for the feature by following the `_site` link. Collections are always represented as a JSON object with an `items` attribute containing an array of representations. Like all other representations, collections have `_links` defined at the top level. Paginated collections include `first`, `last`, `next`, and `prev` links containing a URL with the respective set of elements in the collection. # Updates Resources that accept partial updates use the `PATCH` verb, and support the [JSON Patch](http://tools.ietf.org/html/rfc6902) format. Some resources also support the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) format. In addition, some resources support optional comments that can be submitted with updates. Comments appear in outgoing webhooks, the audit log, and other integrations. ## Updates via JSON Patch [JSON Patch](http://tools.ietf.org/html/rfc6902) is a way to specify the modifications to perform on a resource. For example, in this feature flag representation: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"description\": \"This is the description\", ... } ``` You can change the feature flag's description with the following patch document: ```json [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"This is the new description\" }] ``` JSON Patch documents are always arrays. You can specify multiple modifications to perform in a single request. You can also test that certain preconditions are met before applying the patch: ```json [ { \"op\": \"test\", \"path\": \"/version\", \"value\": 10 }, { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" } ] ``` The above patch request tests whether the feature flag's `version` is `10`, and if so, changes the feature flag's description. Attributes that aren't editable, like a resource's `_links`, have names that start with an underscore. ## Updates via JSON Merge Patch The API also supports the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) format, as well as the [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource. JSON Merge Patch is less expressive than JSON Patch but in many cases, it is simpler to construct a merge patch document. For example, you can change a feature flag's description with the following merge patch document: ```json { \"description\": \"New flag description\" } ``` ## Updates with comments You can submit optional comments with `PATCH` changes. The [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource supports comments. To submit a comment along with a JSON Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"patch\": [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" }] } ``` To submit a comment along with a JSON Merge Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"merge\": { \"description\": \"New flag description\" } } ``` ## Updates via semantic patches The API also supports the Semantic patch format. A semantic `PATCH` is a way to specify the modifications to perform on a resource as a set of executable instructions. JSON Patch uses paths and a limited set of operations to describe how to transform the current state of the resource into a new state. Semantic patch allows you to be explicit about intent using precise, custom instructions. In many cases, semantic patch instructions can also be defined independently of the current state of the resource. This can be useful when defining a change that may be applied at a future date. For example, in this feature flag configuration in environment Production: ```json { \"name\": \"Alternate sort order\", \"kind\": \"boolean\", \"key\": \"sort.order\", ... \"environments\": { \"production\": { \"on\": true, \"archived\": false, \"salt\": \"c29ydC5vcmRlcg==\", \"sel\": \"8de1085cb7354b0ab41c0e778376dfd3\", \"lastModified\": 1469131558260, \"version\": 81, \"targets\": [ { \"values\": [ \"Gerhard.Little@yahoo.com\" ], \"variation\": 0 }, { \"values\": [ \"1461797806429-33-861961230\", \"438580d8-02ee-418d-9eec-0085cab2bdf0\" ], \"variation\": 1 } ], \"rules\": [], \"fallthrough\": { \"variation\": 0 }, \"offVariation\": 1, \"prerequisites\": [], \"_site\": { \"href\": \"/default/production/features/sort.order\", \"type\": \"text/html\" } } } } ``` You can add a date you want a user to be removed from the feature flag's user targets. For example, “remove user 1461797806429-33-861961230 from the user target for variation 0 on the Alternate sort order flag in the production environment on Wed Jul 08 2020 at 15:27:41 pm”. This is done using the following: ```json { \"comment\": \"update expiring user targets\", \"instructions\": [ { \"kind\": \"removeExpireUserTargetDate\", \"userKey\": \"userKey\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\" }, { \"kind\": \"updateExpireUserTargetDate\", \"userKey\": \"userKey2\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1587582000000 }, { \"kind\": \"addExpireUserTargetDate\", \"userKey\": \"userKey3\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1594247266386 } ] } ``` Here is another example. In this feature flag configuration: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"environments\": { \"test\": { \"on\": true } } } ``` You can change the feature flag's description with the following patch document as a set of executable instructions. For example, “add user X to targets for variation Y and remove user A from targets for variation B for test flag”: ```json { \"comment\": \"\", \"instructions\": [ { \"kind\": \"removeUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"852cb784-54ff-46b9-8c35-5498d2e4f270\" }, { \"kind\": \"addUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"1bb18465-33b6-49aa-a3bd-eeb6650b33ad\" } ] } ``` > ### Supported semantic patch API endpoints > > - [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) > - [Update expiring user targets on feature flag](/tag/Feature-flags#operation/patchExpiringUserTargets) > - [Update expiring user target for flags](/tag/User-Settings#operation/patchExpiringFlagsForUser) > - [Update expiring user targets on segment](/tag/Segments#operation/patchExpiringUserTargetsOnSegment) # Errors The API always returns errors in a common format. Here's an example: ```json { \"code\": \"invalid_request\", \"message\": \"A feature with that key already exists\", \"id\": \"30ce6058-87da-11e4-b116-123b93f75cba\" } ``` The general class of error is indicated by the `code`. The `message` is a human-readable explanation of what went wrong. The `id` is a unique identifier. Use it when you're working with LaunchDarkly support to debug a problem with a specific API call. ## HTTP Status - Error Response Codes | Code | Definition | Desc. | Possible Solution | | ---- | ----------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | 400 | Bad Request | A request that fails may return this HTTP response code. | Ensure JSON syntax in request body is correct. | | 401 | Unauthorized | User doesn't have permission to an API call. | Ensure your SDK key is good. | | 403 | Forbidden | User does not have permission for operation. | Ensure that the user or access token has proper permissions set. | | 409 | Conflict | The API request could not be completed because it conflicted with a concurrent API request. | Retry your request. | | 429 | Too many requests | See [Rate limiting](/#section/Rate-limiting). | Wait and try again later. | # CORS The LaunchDarkly API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin. If an `Origin` header is given in a request, it will be echoed as an explicitly allowed origin. Otherwise, a wildcard is returned: `Access-Control-Allow-Origin: *`. For more information on CORS, see the [CORS W3C Recommendation](http://www.w3.org/TR/cors). Example CORS headers might look like: ```http Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, Authorization Access-Control-Allow-Methods: OPTIONS, GET, DELETE, PATCH Access-Control-Allow-Origin: * Access-Control-Max-Age: 300 ``` You can make authenticated CORS calls just as you would make same-origin calls, using either [token or session-based authentication](#section/Authentication). If you’re using session auth, you should set the `withCredentials` property for your `xhr` request to `true`. You should never expose your access tokens to untrusted users. # Rate limiting We use several rate limiting strategies to ensure the availability of our APIs. Rate-limited calls to our APIs will return a `429` status code. Calls to our APIs will include headers indicating the current rate limit status. The specific headers returned depend on the API route being called. The limits differ based on the route, authentication mechanism, and other factors. Routes that are not rate limited may not contain any of the headers described below. > ### Rate limiting and SDKs > > LaunchDarkly SDKs are never rate limited and do not use the API endpoints defined here. LaunchDarkly uses a different set of approaches, including streaming/server-sent events and a global CDN, to ensure availability to the routes used by LaunchDarkly SDKs. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ## Global rate limits Authenticated requests are subject to a global limit. This is the maximum number of calls that can be made to the API per ten seconds. All personal access tokens on the account share this limit, so exceeding the limit with one access token will impact other tokens. Calls that are subject to global rate limits will return the headers below: | Header name | Description | | ------------------------------ | -------------------------------------------------------------------------------- | | `X-Ratelimit-Global-Remaining` | The maximum number of requests the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | We do not publicly document the specific number of calls that can be made globally. This limit may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limit. ## Route-level rate limits Some authenticated routes have custom rate limits. These also reset every ten seconds. Any access tokens hitting the same route share this limit, so exceeding the limit with one access token may impact other tokens. Calls that are subject to route-level rate limits will return the headers below: | Header name | Description | | ----------------------------- | ----------------------------------------------------------------------------------------------------- | | `X-Ratelimit-Route-Remaining` | The maximum number of requests to the current route the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | A _route_ represents a specific URL pattern and verb. For example, the [Delete environment](/tag/Environments#operation/deleteEnvironment) endpoint is considered a single route, and each call to delete an environment counts against your route-level rate limit for that route. We do not publicly document the specific number of calls that can be made to each endpoint per ten seconds. These limits may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limits. ## IP-based rate limiting We also employ IP-based rate limiting on some API routes. If you hit an IP-based rate limit, your API response will include a `Retry-After` header indicating how long to wait before re-trying the call. Clients must wait at least `Retry-After` seconds before making additional calls to our API, and should employ jitter and backoff strategies to avoid triggering rate limits again. # OpenAPI (Swagger) We have a [complete OpenAPI (Swagger) specification](https://app.launchdarkly.com/api/v2/openapi.json) for our API. You can use this specification to generate client libraries to interact with our REST API in your language of choice. This specification is supported by several API-based tools such as Postman and Insomnia. In many cases, you can directly import our specification to ease use in navigating the APIs in the tooling. # Client libraries We auto-generate multiple client libraries based on our OpenAPI specification. To learn more, visit [GitHub](https://github.com/search?q=topic%3Alaunchdarkly-api+org%3Alaunchdarkly&type=Repositories). # Method Overriding Some firewalls and HTTP clients restrict the use of verbs other than `GET` and `POST`. In those environments, our API endpoints that use `PUT`, `PATCH`, and `DELETE` verbs will be inaccessible. To avoid this issue, our API supports the `X-HTTP-Method-Override` header, allowing clients to \"tunnel\" `PUT`, `PATCH`, and `DELETE` requests via a `POST` request. For example, if you wish to call one of our `PATCH` resources via a `POST` request, you can include `X-HTTP-Method-Override:PATCH` as a header. # Beta resources We sometimes release new API resources in **beta** status before we release them with general availability. Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. We try to promote resources into general availability as quickly as possible. This happens after sufficient testing and when we're satisfied that we no longer need to make backwards-incompatible changes. We mark beta resources with a \"Beta\" callout in our documentation, pictured below: > ### This feature is in beta > > To use this feature, pass in a header including the `LD-API-Version` key with value set to `beta`. Use this header with each call. To learn more, read [Beta resources](/#section/Beta-resources). ## Using beta resources To use a beta resource, you must include a header in the request. If you call a beta resource without this header, you'll receive a `403` response. Use this header: ``` LD-API-Version: beta ``` # Versioning We try hard to keep our REST API backwards compatible, but we occasionally have to make backwards-incompatible changes in the process of shipping new features. These breaking changes can cause unexpected behavior if you don't prepare for them accordingly. Updates to our REST API include support for the latest features in LaunchDarkly. We also release a new version of our REST API every time we make a breaking change. We provide simultaneous support for multiple API versions so you can migrate from your current API version to a new version at your own pace. ## Setting the API version per request You can set the API version on a specific request by sending an `LD-API-Version` header, as shown in the example below: ``` LD-API-Version: 20191212 ``` The header value is the version number of the API version you'd like to request. The number for each version corresponds to the date the version was released. In the example above the version `20191212` corresponds to December 12, 2019. ## Setting the API version per access token When creating an access token, you must specify a specific version of the API to use. This ensures that integrations using this token cannot be broken by version changes. Tokens created before versioning was released have their version set to `20160426` (the version of the API that existed before versioning) so that they continue working the same way they did before versioning. If you would like to upgrade your integration to use a new API version, you can explicitly set the header described above. > ### Best practice: Set the header for every client or integration > > We recommend that you set the API version header explicitly in any client or integration you build. > > Only rely on the access token API version during manual testing.
4
+ ## Overview ## Authentication All REST API resources are authenticated with either [personal or service access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens), or session cookies. Other authentication mechanisms are not supported. You can manage personal access tokens on your [Account settings](https://app.launchdarkly.com/settings/tokens) page. LaunchDarkly also has SDK keys, mobile keys, and client-side IDs that are used by our server-side SDKs, mobile SDKs, and client-side SDKs, respectively. **These keys cannot be used to access our REST API**. These keys are environment-specific, and can only perform read-only operations (fetching feature flag settings). | Auth mechanism | Allowed resources | Use cases | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------- | | [Personal access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens) | Can be customized on a per-token basis | Building scripts, custom integrations, data export | | SDK keys | Can only access read-only SDK-specific resources and the firehose, restricted to a single environment | Server-side SDKs, Firehose API | | Mobile keys | Can only access read-only mobile SDK-specific resources, restricted to a single environment | Mobile SDKs | | Client-side ID | Single environment, only flags marked available to client-side | Client-side JavaScript | > #### Keep your access tokens and SDK keys private > > Access tokens should _never_ be exposed in untrusted contexts. Never put an access token in client-side JavaScript, or embed it in a mobile application. LaunchDarkly has special mobile keys that you can embed in mobile apps. If you accidentally expose an access token or SDK key, you can reset it from your [Account Settings](https://app.launchdarkly.com/settings#/tokens) page. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ### Via request header The preferred way to authenticate with the API is by adding an `Authorization` header containing your access token to your requests. The value of the `Authorization` header must be your access token. Manage personal access tokens from the [Account Settings](https://app.launchdarkly.com/settings/tokens) page. ### Via session cookie For testing purposes, you can make API calls directly from your web browser. If you're logged in to the application, the API will use your existing session to authenticate calls. If you have a [role](https://docs.launchdarkly.com/home/team/built-in-roles) other than Admin, or have a [custom role](https://docs.launchdarkly.com/home/team/custom-roles) defined, you may not have permission to perform some API calls. You will receive a `401` response code in that case. > ### Modifying the Origin header causes an error > > LaunchDarkly validates that the Origin header for any API request authenticated by a session cookie matches the expected Origin header. The expected Origin header is `https://app.launchdarkly.com`. > > If the Origin header does not match what's expected, LaunchDarkly returns an error. This error can prevent the LaunchDarkly app from working correctly. > > Any browser extension that intentionally changes the Origin header can cause this problem. For example, the `Allow-Control-Allow-Origin: *` Chrome extension changes the Origin header to `http://evil.com` and causes the app to fail. > > To prevent this error, do not modify your Origin header. > > LaunchDarkly does not require origin matching when authenticating with an access token, so this issue does not affect normal API usage. ## Representations All resources expect and return JSON response bodies. Error responses will also send a JSON body. Read [Errors](#section/Errors) for a more detailed description of the error format used by the API. In practice this means that you always get a response with a `Content-Type` header set to `application/json`. In addition, request bodies for `PUT`, `POST`, `REPORT` and `PATCH` requests must be encoded as JSON with a `Content-Type` header set to `application/json`. ### Summary and detailed representations When you fetch a list of resources, the response includes only the most important attributes of each resource. This is a _summary representation_ of the resource. When you fetch an individual resource (for example, a single feature flag), you receive a _detailed representation_ containing all of the attributes of the resource. The best way to find a detailed representation is to follow links. Every summary representation includes a link to its detailed representation. ### Links and addressability The best way to navigate the API is by following links. These are attributes in representations that link to other resources. The API always uses the same format for links: - Links to other resources within the API are encapsulated in a `_links` object. - If the resource has a corresponding link to HTML content on the site, it is stored in a special `_site` link. Each link has two attributes: an href (the URL) and a type (the content type). For example, a feature resource might return the following: ```json { \"_links\": { \"parent\": { \"href\": \"/api/features\", \"type\": \"application/json\" }, \"self\": { \"href\": \"/api/features/sort.order\", \"type\": \"application/json\" } }, \"_site\": { \"href\": \"/features/sort.order\", \"type\": \"text/html\" } } ``` From this, you can navigate to the parent collection of features by following the `parent` link, or navigate to the site page for the feature by following the `_site` link. Collections are always represented as a JSON object with an `items` attribute containing an array of representations. Like all other representations, collections have `_links` defined at the top level. Paginated collections include `first`, `last`, `next`, and `prev` links containing a URL with the respective set of elements in the collection. ## Updates Resources that accept partial updates use the `PATCH` verb, and support the [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) format. Some resources also support the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) format. In addition, some resources support optional comments that can be submitted with updates. Comments appear in outgoing webhooks, the audit log, and other integrations. ### Updates via JSON Patch [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) is a way to specify the modifications to perform on a resource. For example, in this feature flag representation: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"description\": \"This is the description\", ... } ``` You can change the feature flag's description with the following patch document: ```json [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"This is the new description\" }] ``` JSON Patch documents are always arrays. You can specify multiple modifications to perform in a single request. You can also test that certain preconditions are met before applying the patch: ```json [ { \"op\": \"test\", \"path\": \"/version\", \"value\": 10 }, { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" } ] ``` The above patch request tests whether the feature flag's `version` is `10`, and if so, changes the feature flag's description. Attributes that aren't editable, like a resource's `_links`, have names that start with an underscore. ### Updates via JSON Merge Patch The API also supports the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) format, as well as the [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource. JSON Merge Patch is less expressive than JSON Patch but in many cases, it is simpler to construct a merge patch document. For example, you can change a feature flag's description with the following merge patch document: ```json { \"description\": \"New flag description\" } ``` ### Updates with comments You can submit optional comments with `PATCH` changes. The [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource supports comments. To submit a comment along with a JSON Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"patch\": [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" }] } ``` To submit a comment along with a JSON Merge Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"merge\": { \"description\": \"New flag description\" } } ``` ### Updates via semantic patches The API also supports the Semantic patch format. A semantic `PATCH` is a way to specify the modifications to perform on a resource as a set of executable instructions. JSON Patch uses paths and a limited set of operations to describe how to transform the current state of the resource into a new state. Semantic patch allows you to be explicit about intent using precise, custom instructions. In many cases, semantic patch instructions can also be defined independently of the current state of the resource. This can be useful when defining a change that may be applied at a future date. For example, in this feature flag configuration in environment Production: ```json { \"name\": \"Alternate sort order\", \"kind\": \"boolean\", \"key\": \"sort.order\", ... \"environments\": { \"production\": { \"on\": true, \"archived\": false, \"salt\": \"c29ydC5vcmRlcg==\", \"sel\": \"8de1085cb7354b0ab41c0e778376dfd3\", \"lastModified\": 1469131558260, \"version\": 81, \"targets\": [ { \"values\": [ \"Gerhard.Little@yahoo.com\" ], \"variation\": 0 }, { \"values\": [ \"1461797806429-33-861961230\", \"438580d8-02ee-418d-9eec-0085cab2bdf0\" ], \"variation\": 1 } ], \"rules\": [], \"fallthrough\": { \"variation\": 0 }, \"offVariation\": 1, \"prerequisites\": [], \"_site\": { \"href\": \"/default/production/features/sort.order\", \"type\": \"text/html\" } } } } ``` You can add a date you want a user to be removed from the feature flag's user targets. For example, “remove user 1461797806429-33-861961230 from the user target for variation 0 on the Alternate sort order flag in the production environment on Wed Jul 08 2020 at 15:27:41 pm”. This is done using the following: ```json { \"comment\": \"update expiring user targets\", \"instructions\": [ { \"kind\": \"removeExpireUserTargetDate\", \"userKey\": \"userKey\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\" }, { \"kind\": \"updateExpireUserTargetDate\", \"userKey\": \"userKey2\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1587582000000 }, { \"kind\": \"addExpireUserTargetDate\", \"userKey\": \"userKey3\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1594247266386 } ] } ``` Here is another example. In this feature flag configuration: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"environments\": { \"test\": { \"on\": true } } } ``` You can change the feature flag's description with the following patch document as a set of executable instructions. For example, “add user X to targets for variation Y and remove user A from targets for variation B for test flag”: ```json { \"comment\": \"\", \"instructions\": [ { \"kind\": \"removeUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"852cb784-54ff-46b9-8c35-5498d2e4f270\" }, { \"kind\": \"addUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"1bb18465-33b6-49aa-a3bd-eeb6650b33ad\" } ] } ``` > ### Supported semantic patch API endpoints > > - [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) > - [Update expiring user targets on feature flag](/tag/Feature-flags#operation/patchExpiringUserTargets) > - [Update expiring user target for flags](/tag/User-settings#operation/patchExpiringFlagsForUser) > - [Update expiring user targets on segment](/tag/Segments#operation/patchExpiringUserTargetsForSegment) ## Errors The API always returns errors in a common format. Here's an example: ```json { \"code\": \"invalid_request\", \"message\": \"A feature with that key already exists\", \"id\": \"30ce6058-87da-11e4-b116-123b93f75cba\" } ``` The general class of error is indicated by the `code`. The `message` is a human-readable explanation of what went wrong. The `id` is a unique identifier. Use it when you're working with LaunchDarkly support to debug a problem with a specific API call. ### HTTP Status - Error Response Codes | Code | Definition | Desc. | Possible Solution | | ---- | ----------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | 400 | Bad Request | A request that fails may return this HTTP response code. | Ensure JSON syntax in request body is correct. | | 401 | Unauthorized | User doesn't have permission to an API call. | Ensure your SDK key is good. | | 403 | Forbidden | User does not have permission for operation. | Ensure that the user or access token has proper permissions set. | | 409 | Conflict | The API request could not be completed because it conflicted with a concurrent API request. | Retry your request. | | 429 | Too many requests | See [Rate limiting](/#section/Rate-limiting). | Wait and try again later. | ## CORS The LaunchDarkly API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin. If an `Origin` header is given in a request, it will be echoed as an explicitly allowed origin. Otherwise, a wildcard is returned: `Access-Control-Allow-Origin: *`. For more information on CORS, see the [CORS W3C Recommendation](http://www.w3.org/TR/cors). Example CORS headers might look like: ```http Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, Authorization Access-Control-Allow-Methods: OPTIONS, GET, DELETE, PATCH Access-Control-Allow-Origin: * Access-Control-Max-Age: 300 ``` You can make authenticated CORS calls just as you would make same-origin calls, using either [token or session-based authentication](#section/Authentication). If you’re using session auth, you should set the `withCredentials` property for your `xhr` request to `true`. You should never expose your access tokens to untrusted users. ## Rate limiting We use several rate limiting strategies to ensure the availability of our APIs. Rate-limited calls to our APIs will return a `429` status code. Calls to our APIs will include headers indicating the current rate limit status. The specific headers returned depend on the API route being called. The limits differ based on the route, authentication mechanism, and other factors. Routes that are not rate limited may not contain any of the headers described below. > ### Rate limiting and SDKs > > LaunchDarkly SDKs are never rate limited and do not use the API endpoints defined here. LaunchDarkly uses a different set of approaches, including streaming/server-sent events and a global CDN, to ensure availability to the routes used by LaunchDarkly SDKs. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ### Global rate limits Authenticated requests are subject to a global limit. This is the maximum number of calls that can be made to the API per ten seconds. All personal access tokens on the account share this limit, so exceeding the limit with one access token will impact other tokens. Calls that are subject to global rate limits will return the headers below: | Header name | Description | | ------------------------------ | -------------------------------------------------------------------------------- | | `X-Ratelimit-Global-Remaining` | The maximum number of requests the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | We do not publicly document the specific number of calls that can be made globally. This limit may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limit. ### Route-level rate limits Some authenticated routes have custom rate limits. These also reset every ten seconds. Any access tokens hitting the same route share this limit, so exceeding the limit with one access token may impact other tokens. Calls that are subject to route-level rate limits will return the headers below: | Header name | Description | | ----------------------------- | ----------------------------------------------------------------------------------------------------- | | `X-Ratelimit-Route-Remaining` | The maximum number of requests to the current route the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | A _route_ represents a specific URL pattern and verb. For example, the [Delete environment](/tag/Environments#operation/deleteEnvironment) endpoint is considered a single route, and each call to delete an environment counts against your route-level rate limit for that route. We do not publicly document the specific number of calls that can be made to each endpoint per ten seconds. These limits may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limits. ### IP-based rate limiting We also employ IP-based rate limiting on some API routes. If you hit an IP-based rate limit, your API response will include a `Retry-After` header indicating how long to wait before re-trying the call. Clients must wait at least `Retry-After` seconds before making additional calls to our API, and should employ jitter and backoff strategies to avoid triggering rate limits again. ## OpenAPI (Swagger) We have a [complete OpenAPI (Swagger) specification](https://app.launchdarkly.com/api/v2/openapi.json) for our API. You can use this specification to generate client libraries to interact with our REST API in your language of choice. This specification is supported by several API-based tools such as Postman and Insomnia. In many cases, you can directly import our specification to ease use in navigating the APIs in the tooling. ## Client libraries We auto-generate multiple client libraries based on our OpenAPI specification. To learn more, visit [GitHub](https://github.com/search?q=topic%3Alaunchdarkly-api+org%3Alaunchdarkly&type=Repositories). ## Method Overriding Some firewalls and HTTP clients restrict the use of verbs other than `GET` and `POST`. In those environments, our API endpoints that use `PUT`, `PATCH`, and `DELETE` verbs will be inaccessible. To avoid this issue, our API supports the `X-HTTP-Method-Override` header, allowing clients to \"tunnel\" `PUT`, `PATCH`, and `DELETE` requests via a `POST` request. For example, if you wish to call one of our `PATCH` resources via a `POST` request, you can include `X-HTTP-Method-Override:PATCH` as a header. ## Beta resources We sometimes release new API resources in **beta** status before we release them with general availability. Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. We try to promote resources into general availability as quickly as possible. This happens after sufficient testing and when we're satisfied that we no longer need to make backwards-incompatible changes. We mark beta resources with a \"Beta\" callout in our documentation, pictured below: > ### This feature is in beta > > To use this feature, pass in a header including the `LD-API-Version` key with value set to `beta`. Use this header with each call. To learn more, read [Beta resources](/#section/Beta-resources). ### Using beta resources To use a beta resource, you must include a header in the request. If you call a beta resource without this header, you'll receive a `403` response. Use this header: ``` LD-API-Version: beta ``` ## Versioning We try hard to keep our REST API backwards compatible, but we occasionally have to make backwards-incompatible changes in the process of shipping new features. These breaking changes can cause unexpected behavior if you don't prepare for them accordingly. Updates to our REST API include support for the latest features in LaunchDarkly. We also release a new version of our REST API every time we make a breaking change. We provide simultaneous support for multiple API versions so you can migrate from your current API version to a new version at your own pace. ### Setting the API version per request You can set the API version on a specific request by sending an `LD-API-Version` header, as shown in the example below: ``` LD-API-Version: 20191212 ``` The header value is the version number of the API version you'd like to request. The number for each version corresponds to the date the version was released. In the example above the version `20191212` corresponds to December 12, 2019. ### Setting the API version per access token When creating an access token, you must specify a specific version of the API to use. This ensures that integrations using this token cannot be broken by version changes. Tokens created before versioning was released have their version set to `20160426` (the version of the API that existed before versioning) so that they continue working the same way they did before versioning. If you would like to upgrade your integration to use a new API version, you can explicitly set the header described above. > ### Best practice: Set the header for every client or integration > > We recommend that you set the API version header explicitly in any client or integration you build. > > Only rely on the access token API version during manual testing.
5
5
 
6
6
  The version of the OpenAPI document: 2.0
7
7
  Contact: support@launchdarkly.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.3.0-SNAPSHOT
9
+ OpenAPI Generator version: 5.3.0
10
10
 
11
11
  =end
12
12