Update metric
This endpoint allows you to update the name, description, and metadata properties on a metric. Fields
left out of the request are not changed, and name cannot be empty. If you pass null for the metadata value,
it will clear any existing metadata for that metric.
While a metric is in draft status, its sql and item_id can also be changed. Use
publish metric to make a draft metric active.
Authorizations
API Keys can be issued in the Orb's web application.
Path Parameters
Body
User-specified key/value pairs for the resource. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.
The name of the metric.
"Bytes downloaded"
A description of the metric.
"Sum of bytes downloaded in fast mode"
A new sql string defining the metric. Can only be changed while the metric is in draft status and no price uses it. If the metric has parameters, the new sql must use the same ones.
"SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'"
The id of the item to associate the metric with. Can only be changed while the metric is in draft status.
Response
OK
The Metric resource represents a calculation of a quantity based on events. Metrics are defined by the query that transforms raw usage events into meaningful values for your customers.
User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.
active, draft, archived The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics, and prices and are used for defining external sync behavior for invoices and tax calculation purposes.
The SQL definition of the metric. For metrics defined via configuration rather than SQL, this is a derived SQL representation.