You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Request with spending_categories payload returns non-200 error.
Comparing the JSON code with API doc I found that true or false in match_all should not be inside square brackets. Removing them makes the code work.
library(repoRter.nih)
req<- make_req(criteria=list(fiscal_years=2010,
spending_categories=list(values= c(873, 180), match_all=T))
)
#> This is your JSON payload:#> {#> "criteria": {#> "fiscal_years": [#> 2010#> ],#> "spending_categories": {#> "values": [#> 873,#> 180#> ],#> "match_all": [#> true#> ]#> },#> "use_relevance": false,#> "include_active_projects": false,#> "exclude_subprojects": false,#> "multi_pi_only": false,#> "newly_added_projects_only": false,#> "sub_project_only": false#> },#> "offset": 0,#> "limit": 500#> }#> #> If you receive a non-200 API response, compare this formatting (boxes, braces, quotes, etc.) to the 'Complete Payload' schema provided here:#> https://api.reporter.nih.gov/?urls.primaryName=V2.0#/Search/post_v2_projects_searchres<- get_nih_data(req)
#> Retrieving first page of results (up to 500 records)#> Request failed [400]. Retrying in 1 seconds...#> Request failed [400]. Retrying in 2.6 seconds...#> API Error: received non-200 response - please try again later and if the issue persists#> report the issue to the package maintainer (include the request JSON which is failing).# Remove square brackets around true or falsereq= structure(stringr::str_replace(req, "\\[((true)|(false))\\]", "\\1"), class="json")
res<- get_nih_data(req)
#> Retrieving first page of results (up to 500 records)
Request with spending_categories payload returns non-200 error.
Comparing the JSON code with API doc I found that true or false in
match_all
should not be inside square brackets. Removing them makes the code work.Created on 2024-06-12 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: