Usage Meters
Create an usage meter
Changed onCreate an usage meter and associate with an event schema
post/usage_meters
Request
- Base URLhttps://api.togai.com
- AuthHTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"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"
}
]
}Response
Response for Create and Get usage event requests
Example response
{
"name": "rides-usage",
"billableName": "Rides Usage",
"description": "Meter to track cab rides",
"type": "COUNTER",
"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"
}
]
}Changes
- info
added the new optional request property
- info
added the optional property
to the response with the status
- info
- info
the request property
became optional
- info