improper formatting of dates sent to cbdate and cedate parameters
Open
Beginner friendly
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 26
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
There is an issue where RAQSAPI is not properly formatting dates passed to the cedate or cbdate parameters. e.g.
aqs_monitors_by_site(parameter = '42401',
bdate = as.Date('20150501',
format='%Y%m%d'),
edate = as.Date('20190501',
format='%Y%m%d'),
stateFIPS = '15',
countycode = '001',
sitenum = '0007',
cbdate= as.Date('20150501',
format='%Y%m%d')
running this code will throw the following error message
Error in `purrr::pmap()` at RAQSAPI/R/bysite.R:66:3:
ℹ In index: 1.
Caused by error in `httr2::req_perform()`:
! HTTP 400 Bad Request.
ℹ At server request time: Wed, 05 Aug 2026 19:51:50 GMT RAQSAPI experienced an error while processing the following url:
https://aqs.epa.gov/data/api/monitors/bySite?email=<redacted>&key=<redacted>¶m=42401&bdate=20150501&edate=20190501&state=15&county=001&site=0007&cbdate=2015-05-01 with status_code: 400 and status message:
400 Server error message: cbdate: 2015-05-01, requires the following format: yyyymmdd.
Run `rlang::last_trace()` to see where the error occurred.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in RAQSAPI/R/bysite.R at the pmap call reported near line 66, and reproduce the provided aqs_monitors_by_site example. Trace how Date values are serialized for cbdate and cedate, then verify that both parameters are sent in the API's yyyymmdd format and the request no longer returns HTTP 400.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100