Search
Search events
v1.usage.search(**kwargs) -> idStringcustomer_idStringevent_typeStringtimestampTimetransaction_idStringis_duplicateboolmatched_billable_metricsarraymatched_customerobjectprocessed_atTimepropertieshashUsageSearchResponse
post/v1/events/search
For a set of events, look up matched billable metrics and customers by transaction id. This endpoint looks at transactions that occurred in the last 34 days, and is intended for sampling-based testing workflows. It is heavily rate limited.
Parameters
transaction_idsarray
Array[String]
The transaction IDs of the events to retrieve
Returns
Array[{ id, customer_id, event_type, 7 more}]
require "metronome_sdk"
metronome = MetronomeSDK::Client.new(bearer_token: "My Bearer Token")
response = metronome.v1.usage.search(transaction_ids: ["2021-01-01T00:00:00Z_cluster42"])
puts(response)
200 Example
[
{
"id": "id",
"customer_id": "customer_id",
"event_type": "event_type",
"timestamp": "2019-12-27T18:11:19.117Z",
"transaction_id": "transaction_id",
"is_duplicate": true,
"matched_billable_metrics": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "name",
"aggregate": "aggregate",
"aggregate_keys": [
"string"
],
"aggregation_key": "aggregation_key",
"aggregation_type": "COUNT",
"archived_at": "2019-12-27T18:11:19.117Z",
"custom_fields": {
"foo": "string"
},
"event_type_filter": {
"in_values": [
"string"
],
"not_in_values": [
"string"
]
},
"filter": {
"foo": "bar"
},
"group_by": [
"string"
],
"group_keys": [
[
"string"
]
],
"property_filters": [
{
"name": "name",
"exists": true,
"in_values": [
"string"
],
"not_in_values": [
"string"
]
}
],
"sql": "sql"
}
],
"matched_customer": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "name"
},
"processed_at": "2019-12-27T18:11:19.117Z",
"properties": {
"foo": "bar"
}
}
]