Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code list names with spaces are not urlEncoded #18

Open
peterdesmet opened this issue Mar 18, 2022 · 2 comments
Open

Code list names with spaces are not urlEncoded #18

peterdesmet opened this issue Mar 18, 2022 · 2 comments
Assignees
Labels

Comments

@peterdesmet
Copy link

Some code lists have a space in their name, e.g. Platform Class. It is currently not possible to query these with getCodeList(). The solution is to utils::URLencode() the input parameter within the function, before passing it to the API, so that:

Platform Class becomes Platform%20Class:

library(icesVocab)
code_list <- "Platform Class"
codes <- getCodeList(code_list) # Error
#> Warning in readVocab(url): HTTP error 400.

code_list_encoded <- utils::URLencode(code_list)
code_list_encoded
#> [1] "Platform%20Class"
codes <- getCodeList(code_list_encoded) # Works fine

Created on 2022-03-18 by the reprex package (v2.0.1)

@peterdesmet
Copy link
Author

Note that this should also be adapted in getCodeDetail()

@colinpmillar
Copy link
Member

thanks Peter! I'll fix and update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants