#dennis_de
1 messages · Page 1 of 1 (latest)
I could only find https://stripe.com/docs/api/usage_records/subscription_item_summary_list, which apparently does not provide aggregated data but only for one period.
I don't have a test record available on hand. Can you send a screenshot of the data you want to get?
one second
Sorry, the screenshot is now in German. But in the end it is the detailed registered usages within a period.
Ahhh, okay. So the data won't be aggregated like it is in the Dashboard, but you could pull all the Usage Records via the API and group them by the Subscription Item ID in order to create an aggregation. Aside from that, I don't know of another way to achieve the same view of data
Retrieving them is exactly the problem; I get them aggregated via https://stripe.com/docs/api/usage_records/subscription_item_summary_list.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Right. You would need to transform the data from a list of Usage Records to whatever you are wanting it to look like
That is clear to me, but where do I find the endpoint that does not give it back to me aggregated but each registered usage individually as in the dashboard?
I somehow couldn't find an endpoint to get this data from the API, at least unsummed.
but where do I find the endpoint that does not give it back to me aggregated but each registered usage individually as in the dashboard?
There is no API that gives it to you the way you see it in the Dashboard. You have to take the list of Usage Records the API gives you and pull out the data you need from each individual Usage Record
But how? That seems impossible to me.
How am I supposed to get the individual usage records if I only get them totalled for the period? I don't see any chance of recreating this.
I don't understand what you mean "totalled for the period". A list of Usage Records is a list of occurrences in which you reported usage. Each Usage Record is a Usage Record object that contains all the data from your screenshot: https://stripe.com/docs/api/usage_records/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
And how do I retrieve the object?
The link is only the definition of the object.
At the endpoint "usage_record_summaries", the object "usage_record_summary" comes back. But as you say, it's about the object "usage_record" which I don't get back.
Ah, apologies, I misread the docs thinking that the usage record summary included individual Usage Record object IDs. That's odd.
I can't read German, but doesn't the usage summary have all the same information? https://stripe.com/docs/api/usage_records/subscription_item_summary_list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
No, the screenshot shows every single registered usage at a timestamp for a period. At the endpoint "usage_record_summaries" only the periods with a "total_usage" (aggregated total) are returned.
I'm going to bed now, but feel free to leave the thread open and I'll read the answer tomorrow and reply again with any queries.