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

Learning about APIs :) #32

Open
samanthacsik opened this issue Mar 17, 2024 · 0 comments
Open

Learning about APIs :) #32

samanthacsik opened this issue Mar 17, 2024 · 0 comments

Comments

@samanthacsik
Copy link
Owner

samanthacsik commented Mar 17, 2024

Needed a place to job down random things; need to organize better soom.

{httr2} package

HTTP protocol: there's a url that specifies the location + there can then be query parameters, which are designated by a ? + anything that follows

E.g. UC Census Bureau (not a very nicely-documented API...)
api.census.gov/data/2021/pep/population?get=DENSITY_2021,POP_2021,NAME,STATE&for=region:*&key=YOUR_KEY

  • api.census.gov/data/2021/pep/population: API endpoint, which correesponds to a resource that a server knows how to provide back; in this case, that resource is the 2021 pop estimate
  • ?get=DENSITY_2021,POP_2021,NAME,STATE&for=region:*&key=YOUR_KEY: this is the query string that contains all of the parameters (variables) that are being passed in this example API call that affect the output of the request
  • get, for, key: all accepted query string parameters
  • get accepts a list of strings, for accepts a string, and key is your API key
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

No branches or pull requests

1 participant