Skip to content

Add AdditionalProperties access example for GetUsageSummary#3688

Draft
charlie-zhang109 wants to merge 3 commits into
masterfrom
czhang/usage-summary-additional-properties-example
Draft

Add AdditionalProperties access example for GetUsageSummary#3688
charlie-zhang109 wants to merge 3 commits into
masterfrom
czhang/usage-summary-additional-properties-example

Conversation

@charlie-zhang109

Copy link
Copy Markdown
Contributor

Summary

  • Adds examples/v1/usage-metering/GetUsageSummary_additional_properties.py demonstrating how to read every field at all three response levels of GET /api/v1/usage/summary using additionalProperties.
  • Calls the v2 GetUsageSummaryAvailableFields endpoint first to retrieve response_fields, date_fields, and date_org_fields — the authoritative list of keys emitted by the v1 endpoint.
  • Iterates each field list against the corresponding response level (UsageSummaryResponseUsageSummaryDateUsageSummaryDateOrg) using .get() and prints non-None values.

Three layers covered

Layer Object Field list
1 UsageSummaryResponse (top-level) response_fields
2 UsageSummaryDate (usage[]) date_fields
3 UsageSummaryDateOrg (usage[].orgs[]) date_org_fields

Test plan

  • Run python examples/v1/usage-metering/GetUsageSummary_additional_properties.py with valid DD_API_KEY / DD_APP_KEY credentials to verify all three layers print correctly.
  • Confirm the example follows existing file conventions (header docstring, Configuration(), ApiClient context manager).

🤖 Generated with Claude Code

charlie-zhang109 and others added 3 commits June 15, 2026 14:21
Demonstrates how to call the v2 GetUsageSummaryAvailableFields endpoint
to obtain the canonical field lists, then walk all three response levels
of the v1 GetUsageSummary response (UsageSummaryResponse, UsageSummaryDate,
UsageSummaryDateOrg) reading every non-None value via .get().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… all layers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant