Search
Search events
client.V1.Usage.Search(ctx, body) (*[]V1UsageSearchResponse, error)
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
bodyTransactionIDsfieldV1UsageSearchParams
Returns
V1UsageSearchResponsetype
package main
import (
"context"
"fmt"
"github.com/Metronome-Industries/metronome-go"
"github.com/Metronome-Industries/metronome-go/option"
)
func main() {
client := metronome.NewClient(
option.WithBearerToken("My Bearer Token"),
)
response, err := client.V1.Usage.Search(context.TODO(), metronome.V1UsageSearchParams{
TransactionIDs: metronome.F([]string{"2021-01-01T00:00:00Z_cluster42"}),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", 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"
}
}
]