Skip to content

Add curl examples for EVENTCOUNTLIMIT and AIAPIQUOTALIMIT subscription throttle policies#11350

Open
Tharsanan1 wants to merge 1 commit into
wso2:masterfrom
Tharsanan1:fix/issue-16719-port-latest
Open

Add curl examples for EVENTCOUNTLIMIT and AIAPIQUOTALIMIT subscription throttle policies#11350
Tharsanan1 wants to merge 1 commit into
wso2:masterfrom
Tharsanan1:fix/issue-16719-port-latest

Conversation

@Tharsanan1
Copy link
Copy Markdown
Contributor

Summary

Adds inline curl examples for creating streaming (EVENTCOUNTLIMIT) and AI (AIAPIQUOTALIMIT) subscription throttling policies to the admin v4 API spec.

Previously the POST /throttling/policies/subscription endpoint only had a generic curl example referencing a @data.json file with no inline payload. Developers had to dig through the schema to construct the correct payload for non-REQUESTCOUNTLIMIT quota types.

Changes

  • Added curl example with inline EVENTCOUNTLIMIT payload (streaming policies like AsyncGold)
  • Added curl example with inline AIAPIQUOTALIMIT payload (AI API policies like AIGold)
  • Both examples include realistic field values matching the existing built-in policies

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Review Change Stack

📝 Walkthrough

Summary

This PR extends the Admin v4 API specification documentation by adding two inline curl examples to the POST /throttling/policies/subscription endpoint. Previously, this endpoint contained only a generic curl example that referenced an external @data.json file without providing an inline request payload.

Changes Made

File Modified: en/docs/reference/product-apis/admin-apis/admin-v4/admin-v4.yaml

Two new code samples were added to the x-code-samples section of the subscription throttling policy creation operation:

  1. EVENTCOUNTLIMIT Example - Demonstrates creating an "AsyncGold" streaming subscription policy with event count limits (50,000 events per day)
  2. AIAPIQUOTALIMIT Example - Demonstrates creating an "AIGold" AI API subscription policy with AI quota limits (50,000 total tokens and 500 requests per minute)

Both examples provide complete, inline JSON payloads showing the proper structure for their respective quota types, including fields like timeUnit, unitTime, eventCount, requestCount, totalTokenCount, and related configuration options. These payloads match the structures of existing built-in policies.

Impact: Documentation-only change. No modifications to API schemas, operation signatures, or functional behavior.

Lines Changed: +43 lines added

Walkthrough

This pull request extends the OpenAPI documentation for the subscription throttling policy creation endpoint by adding two new Curl code sample requests. The examples demonstrate how to configure subscription throttling policies using EVENTCOUNTLIMIT and AIAPIQUOTALIMIT policy types, each with their respective defaultLimit structures and configuration fields. No API schema or operation signatures were modified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks required template sections (Purpose, Goals, Approach, User stories, Release note, Documentation, etc.) and instead provides only a summary of changes. Complete the pull request description using the repository template, including Purpose, Goals, Approach, Documentation impact, and other required sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding curl examples for two specific subscription throttle policy types (EVENTCOUNTLIMIT and AIAPIQUOTALIMIT).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@en/docs/reference/product-apis/admin-apis/admin-v4/admin-v4.yaml`:
- Around line 530-531: Replace the hard-coded bearer token in the curl examples
with a placeholder (e.g., <ACCESS_TOKEN>) so the Authorization header reads
Authorization: Bearer <ACCESS_TOKEN>; update both instances mentioned in the
file (the curl sample around the current diff and the other sample at the
indicated second occurrence) to avoid exposing real tokens and satisfy the
security guideline.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 51514070-44a1-4c51-97aa-0c18ecbb2888

📥 Commits

Reviewing files that changed from the base of the PR and between 00e7ccd and 3068b3e.

📒 Files selected for processing (1)
  • en/docs/reference/product-apis/admin-apis/admin-v4/admin-v4.yaml

Comment on lines +530 to +531
curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" \
-H "Content-Type: application/json" \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use an access-token placeholder in new curl examples.

Replace the inline bearer value with a placeholder (for example, <ACCESS_TOKEN>) in both new samples to avoid security-scan noise and keep examples clearly non-sensitive.

As per coding guidelines, "Provide concise, actionable feedback focused on correctness and best practices."

Also applies to: 550-551

🧰 Tools
🪛 Betterleaks (1.2.0)

[high] 530-530: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@en/docs/reference/product-apis/admin-apis/admin-v4/admin-v4.yaml` around
lines 530 - 531, Replace the hard-coded bearer token in the curl examples with a
placeholder (e.g., <ACCESS_TOKEN>) so the Authorization header reads
Authorization: Bearer <ACCESS_TOKEN>; update both instances mentioned in the
file (the curl sample around the current diff and the other sample at the
indicated second occurrence) to avoid exposing real tokens and satisfy the
security guideline.

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