Skip to content

docs: document multi-code batching — 20 codes, one request (api#7240) - #73

Merged
karlwaldman merged 2 commits into
mainfrom
docs/document-multi-code-batching
Aug 23, 2026
Merged

docs: document multi-code batching — 20 codes, one request (api#7240)#73
karlwaldman merged 2 commits into
mainfrom
docs/document-multi-code-batching

Conversation

@karlwaldman

Copy link
Copy Markdown
Member

The API accepts up to 20 comma-separated commodity codes in one request that counts once against quota. This SDK has always supported that — and the README never said so.

Grepped all three non-Python SDK READMEs for any mention of batching, comma-separated codes, or the cap: zero hits in each. Users could not discover a 20× quota saving. On the free plan that is the difference between 50 code-reads a day and 1,000.

Verified by running it, not by reading the source

Node, against the live API with a real key:

3 prices in ONE request

Also confirmed the comma survives URL encoding — both the raw , and %2C forms return 200 with data.prices[].

Not a code change

Unlike the Python SDK (api#7240, fixed and released as 1.13.0), this client has no per-code loop. It passes by_code straight through, so batching already worked.

The split is worth naming: Python had a broken batch helper; Go, Node and PHP had no affordance at all. Different defect, same cost to the user.

What the section covers

  • the 20-code cap and that the call bills once
  • a working example in this language
  • the free-plan arithmetic
  • the two failure modes a caller actually hits — 400 over 20 codes, and 400 with a "did you mean" for an unrecognised code
  • a link to the polling-interval guidance shipped in oilpriceapi-docs#141

Refs api#7240, api#7235

🤖 Generated with Claude Code

https://claude.ai/code/session_01JKAExynd9zoKwt6rYA66EA

The API accepts up to 20 comma-separated commodity codes in a single request
that counts ONCE against quota. This SDK has always supported it and the README
never said so — zero mentions of batching, comma-separated codes, or the cap.

Users could not discover a 20x quota saving. On the free plan that is the
difference between 50 code-reads a day and 1,000.

Verified by running it, not by reading the source:
  node against the live API -> 3 prices in ONE request

Also documents the two failure modes a caller will actually hit: 21+ codes
returns 400 "Too many commodity codes requested (max: 20, requested: N)", and
an unrecognised code returns 400 with a "did you mean" suggestion.

NOT a code change. Unlike the Python SDK (api#7240), this client has no
per-code loop — it passes by_code straight through, so batching already worked.
Python had a broken batch helper; the other three had no affordance at all.

Refs api#7240, api#7235

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JKAExynd9zoKwt6rYA66EA
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3803c8cc-d621-4088-9fac-5dded4a8e09f


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.

CI rejected the first version:

  Error: README.md: fixed demo rate "50 requests a day"

scripts/validate-storefront-claims.mjs (and its siblings) forbid plan
specifics in an SDK README — "free tier", fixed quota windows, and fixed
request rates. That is deliberate and correct: plans change, SDKs release on
their own cadence, and a stale allowance baked into a published package is
worse than none at all.

It is also exactly the failure this whole thread is about. The docs site
published "200 requests per month" for 17 days after the plan became 50/day
(api#7235). I then wrote the new number into three SDK READMEs that release
independently — the same mistake, one layer down. The guard caught it; nothing
caught the docs site.

Rewritten to state the mechanism and the RATIO, which is true regardless of
plan: twenty codes in one call stretches an allowance twenty times. Plan
specifics now live behind a link to the rate-limiting guide, which is where
they can be kept current.

Kept: the 20-code cap and both 400 responses — those are API contract, not
plan claims.

Verified locally before pushing: node scripts/validate-storefront-claims.mjs
-> validated 36 Node public surfaces, pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JKAExynd9zoKwt6rYA66EA
@karlwaldman
karlwaldman merged commit d8dbe62 into main Aug 23, 2026
8 checks passed
@karlwaldman
karlwaldman deleted the docs/document-multi-code-batching branch August 23, 2026 22:15
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