Marketplace Metering API, gRPC: ProductUsageService.Write
Writes product's usage (authenticated by publisher's service account)
gRPC request
rpc Write (WriteUsageRequest) returns (WriteUsageResponse)
WriteUsageRequest
{
"dry_run": "bool",
"product_instance_id": "string",
"usage_records": [
{
"uuid": "string",
"sku_id": "string",
"quantity": "int64",
"timestamp": "google.protobuf.Timestamp"
}
]
}
|
Field |
Description |
|
dry_run |
bool Do not write usage, only validate |
|
product_instance_id |
string Required field. Marketplace Product Instance's ID |
|
usage_records[] |
List of product usage records (up to 25 per request) |
UsageRecord
|
Field |
Description |
|
uuid |
string Required field. Unique identifier of the usage record (UUID format). |
|
sku_id |
string Required field. Consumed Marketplace SKU ID, linked to |
|
quantity |
int64 Quantity of SKU consumed, measured in |
|
timestamp |
Required field. Timestamp in UTC for which the usage is being reported. |
WriteUsageResponse
{
"accepted": [
{
"uuid": "string"
}
],
"rejected": [
{
"uuid": "string",
"reason": "Reason"
}
]
}
|
Field |
Description |
|
accepted[] |
List of accepted product usage records |
|
rejected[] |
List of rejected product usage records (with reason) |
AcceptedUsageRecord
|
Field |
Description |
|
uuid |
string Unique identifier of the usage record (UUID format). |
RejectedUsageRecord
|
Field |
Description |
|
uuid |
string Unique identifier of the usage record (UUID format). |
|
reason |
enum Reason The reason of rejection.
|