Skip to content

Add example: read UsageSummary fields via additionalProperties#3995

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

Add example: read UsageSummary fields via additionalProperties#3995
charlie-zhang109 wants to merge 3 commits into
masterfrom
czhang/usage-summary-additional-properties-example

Conversation

@charlie-zhang109

Copy link
Copy Markdown

Summary

  • Adds examples/v2/usage-metering/GetUsageSummary_additional_properties.java, a worked example showing how to enumerate all fields returned by GET /api/v1/usage/summary — including newly added billing dimensions that land in additionalProperties rather than typed fields.
  • Calls GET /api/v2/usage/summary/available_fields (v2) first to retrieve the canonical field lists (responseFields, dateFields, dateOrgFields) from UsageSummaryAvailableFieldsAttributes.
  • Calls GET /api/v1/usage/summary (v1) with includeOrgDetails(true) to get the full three-level hierarchy.
  • Iterates all three levels — response, UsageSummaryDate, and UsageSummaryDateOrg — calling getAdditionalProperty(field) for each discovered key and printing non-null values.

Test plan

  • Review the example compiles against the existing models in src/main/java/com/datadog/api/client/v1/model/ and src/main/java/com/datadog/api/client/v2/model/.
  • Verify import paths: com.datadog.api.client.v1.model.{UsageSummaryResponse,UsageSummaryDate,UsageSummaryDateOrg} and com.datadog.api.client.v2.model.{UsageSummaryAvailableFieldsResponse,UsageSummaryAvailableFieldsAttributes}.
  • Run manually against a real org to confirm all three levels print non-null values for known fields.

🤖 Generated with Claude Code

charlie-zhang109 and others added 3 commits June 15, 2026 14:21
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