Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
## R-api_new
# _KUB Datalab: APIs with R_ <a href="https://kubdatalab.github.io/R-api/"><img src="episodes/fig/stickerattempt.png" align="right" height="138" alt="KUB Datalab R-API website" /></a>

This is the lesson repository for R-api_new
<!-- badges: start -->
[![DOI](https://zenodo.org/badge/835153711.svg)](https://doi.org/10.5281/zenodo.17803256)
<!-- badges: end -->


This is an introduction to working with APIs in R, designed for participants with
limited programming experience. It can be taught in 2 hours.

The lesson starts with covering the basics of API calls using GET and POST. It then explores
GET requests against a very simple API. It continues with POST requests to Statistics Denmark,
and concludes with a discussion of the package `danstat` as an alternative before offering
tools for working with some of the slightly exotic time formats returned by Statistics Denmark.

## Prerequisites

The lesson requires some prior knowledge of R and RStudio/Positron. Learners should have R and
Positron (or RStudio) installed on their computers. They will also need to be able to install
R packages from CRAN, create directories and download files.
See the [lesson website](https://kubdatalab.github.io/R-api/#software-setup){target="_blank"} for instructions on installing R and Positron.

## KUB Datalab

[KUB Datalab](https://kub.kb.dk/datalab){target="_blank"} is [Copenhagen University Library](https://kub.ku.dk/english/){target="_blank"}'s center for working with data. Our primary focus is to support students at the [University of Copenhagen](https://www.ku.dk/en){target="_blank"} in regards to theri work with data and digital methods.

Binary file added episodes/fig/stickerattempt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion episodes/introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exercises: 2
This course assumes a certain level of knowledge about R. We are not going
to cover the basics, and we are assuming that you know how to use the following functionalities in R before starting this course:

- <a href="https://kubdatalab.github.io/R-api_new/#software-setup" target="_blank">Have R and R-studio installed</a>
- <a href="https://kubdatalab.github.io/R-api/#software-setup" target="_blank">Have R and R-studio installed</a>
- Alternatively run everything on rstudio.cloud
- Know how to assign values to variables
- Know what a function is, and how we pass input and parameters to it
Expand Down
2 changes: 1 addition & 1 deletion episodes/post-statistics-denmark.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Let us try it:
result <- httr::POST(endpoint, body=our_body, encode = "json")
```

We ask to get the result in json, a speciel datastructure that is able to contain almost anything.
We specify that the request should be encoded as "json".

Let us look at the result:

Expand Down