Skip to content

Latest commit

 

History

History
376 lines (268 loc) · 9.78 KB

MetricsApi.md

File metadata and controls

376 lines (268 loc) · 9.78 KB

LaunchDarklyApi::MetricsApi

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

Method HTTP request Description
delete_metric DELETE /api/v2/metrics/{projectKey}/{metricKey} Delete metric
get_metric GET /api/v2/metrics/{projectKey}/{metricKey} Get metric
get_metrics GET /api/v2/metrics/{projectKey} List metrics
patch_metric PATCH /api/v2/metrics/{projectKey}/{metricKey} Update metric
post_metric POST /api/v2/metrics/{projectKey} Create metric

delete_metric

delete_metric(project_key, metric_key)

Delete metric

Delete a metric by key.

Examples

require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
  # Configure API key authorization: ApiKey
  config.api_key['ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKey'] = 'Bearer'
end

api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key
metric_key = 'metric_key_example' # String | The metric key

begin
  # Delete metric
  api_instance.delete_metric(project_key, metric_key)
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->delete_metric: #{e}"
end

Using the delete_metric_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> delete_metric_with_http_info(project_key, metric_key)

begin
  # Delete metric
  data, status_code, headers = api_instance.delete_metric_with_http_info(project_key, metric_key)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->delete_metric_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key
metric_key String The metric key

Return type

nil (empty response body)

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_metric

get_metric(project_key, metric_key)

Get metric

Get information for a single metric from the specific project.

Examples

require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
  # Configure API key authorization: ApiKey
  config.api_key['ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKey'] = 'Bearer'
end

api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key
metric_key = 'metric_key_example' # String | The metric key

begin
  # Get metric
  result = api_instance.get_metric(project_key, metric_key)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->get_metric: #{e}"
end

Using the get_metric_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_metric_with_http_info(project_key, metric_key)

begin
  # Get metric
  data, status_code, headers = api_instance.get_metric_with_http_info(project_key, metric_key)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <MetricRep>
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->get_metric_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key
metric_key String The metric key

Return type

MetricRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_metrics

get_metrics(project_key)

List metrics

Get a list of all metrics for the specified project.

Examples

require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
  # Configure API key authorization: ApiKey
  config.api_key['ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKey'] = 'Bearer'
end

api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key

begin
  # List metrics
  result = api_instance.get_metrics(project_key)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->get_metrics: #{e}"
end

Using the get_metrics_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_metrics_with_http_info(project_key)

begin
  # List metrics
  data, status_code, headers = api_instance.get_metrics_with_http_info(project_key)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <MetricCollectionRep>
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->get_metrics_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key

Return type

MetricCollectionRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

patch_metric

patch_metric(project_key, metric_key, patch_operation)

Update metric

Patch a metric by key.

Examples

require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
  # Configure API key authorization: ApiKey
  config.api_key['ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKey'] = 'Bearer'
end

api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key
metric_key = 'metric_key_example' # String | The metric key
patch_operation = [LaunchDarklyApi::PatchOperation.new({op: 'replace', path: '/exampleField', value: new example value})] # Array<PatchOperation> | 

begin
  # Update metric
  result = api_instance.patch_metric(project_key, metric_key, patch_operation)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->patch_metric: #{e}"
end

Using the patch_metric_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> patch_metric_with_http_info(project_key, metric_key, patch_operation)

begin
  # Update metric
  data, status_code, headers = api_instance.patch_metric_with_http_info(project_key, metric_key, patch_operation)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <MetricRep>
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->patch_metric_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key
metric_key String The metric key
patch_operation Array<PatchOperation>

Return type

MetricRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

post_metric

post_metric(project_key, metric_post)

Create metric

Create a new metric in the specified project. The expected POST body differs depending on the specified kind property.

Examples

require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
  # Configure API key authorization: ApiKey
  config.api_key['ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKey'] = 'Bearer'
end

api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key
metric_post = LaunchDarklyApi::MetricPost.new({key: 'example-metric', kind: 'pageview'}) # MetricPost | 

begin
  # Create metric
  result = api_instance.post_metric(project_key, metric_post)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->post_metric: #{e}"
end

Using the post_metric_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> post_metric_with_http_info(project_key, metric_post)

begin
  # Create metric
  data, status_code, headers = api_instance.post_metric_with_http_info(project_key, metric_post)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <MetricRep>
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling MetricsApi->post_metric_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key
metric_post MetricPost

Return type

MetricRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json