curl --request PATCH \
--url https://api.togai.com/usage_meters/{usage_meter_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"billableName": "<string>",
"description": "<string>",
"eventSchemaName": "<string>",
"type": "COUNTER",
"aggregation": "COUNT",
"computations": [
{
"id": "<string>",
"matcher": "{\n \"and\": [\n {\"in\": [{\"var\": \"dimension.city\"}, \"chennai\", \"mumbai\"]},\n \"or\": [\n {\">\": [{\"var\": \"attribute.distance\"}, 100]},\n {\"<\": [{\"var\": \"attribute.distance\"}, 20]}\n ]\n ]\n}\n",
"computation": {
"*": [
{
"var": "attributes.distance"
},
0.4
]
},
"order": 123
}
],
"filters": [
{
"field": "<string>",
"value": "<string>"
}
]
}'
{
"id": "um.1zlQTBWlkeO.lB7fh",
"name": "Rides",
"displayName": "Rides",
"description": "Cab rides",
"type": "COUNTER",
"aggregation": "COUNT",
"status": "DRAFT",
"computations": [
{
"matcher": "{\n \"and\": [\n {\"in\": [{\"var\": \"dimension.city\"}, \"chennai\", \"mumbai\"]},\n \"or\": [\n {\">\": [{\"var\": \"attribute.distance\"}, 100]},\n {\"<\": [{\"var\": \"attribute.distance\"}, 20]}\n ]\n ]\n}\n",
"order": 1,
"computation": "1"
}
]
}
This API lets you update an existing usage meter.
curl --request PATCH \
--url https://api.togai.com/usage_meters/{usage_meter_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"billableName": "<string>",
"description": "<string>",
"eventSchemaName": "<string>",
"type": "COUNTER",
"aggregation": "COUNT",
"computations": [
{
"id": "<string>",
"matcher": "{\n \"and\": [\n {\"in\": [{\"var\": \"dimension.city\"}, \"chennai\", \"mumbai\"]},\n \"or\": [\n {\">\": [{\"var\": \"attribute.distance\"}, 100]},\n {\"<\": [{\"var\": \"attribute.distance\"}, 20]}\n ]\n ]\n}\n",
"computation": {
"*": [
{
"var": "attributes.distance"
},
0.4
]
},
"order": 123
}
],
"filters": [
{
"field": "<string>",
"value": "<string>"
}
]
}'
{
"id": "um.1zlQTBWlkeO.lB7fh",
"name": "Rides",
"displayName": "Rides",
"description": "Cab rides",
"type": "COUNTER",
"aggregation": "COUNT",
"status": "DRAFT",
"computations": [
{
"matcher": "{\n \"and\": [\n {\"in\": [{\"var\": \"dimension.city\"}, \"chennai\", \"mumbai\"]},\n \"or\": [\n {\">\": [{\"var\": \"attribute.distance\"}, 100]},\n {\"<\": [{\"var\": \"attribute.distance\"}, 20]}\n ]\n ]\n}\n",
"order": 1,
"computation": "1"
}
]
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
50
"um.1zYnCiM9Bpg.1zYn"
Payload to create usage meter
Request to update usage meter
Response for Create and Get usage event requests
Structure of usage meter