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
Copy file name to clipboardExpand all lines: part-advanced-topics/05-APIs.qmd
+22-49Lines changed: 22 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -84,56 +84,22 @@ HTTP requests have a request header and a request body.
84
84
85
85
HTTP requests will return a response code.
86
86
87
-
In general, 2xx is Success, 3xx is 'address moved', 4xx is 'client screwed up', and 5xx is 'server screwed up', but you can find a full list [here](https://www.coderstool.com/http-response-codes).
88
-
You're probably familiar with a 404 error, which
87
+
I prefer the very general summary [@AllHTTPStatus2023]:
89
88
90
-
::: column-margin
91
-
Julia Evans [@evansQuestionsHTTPStatus2020] has some lovely Q&A flashcards on HTTP codes, and there is a cartoon-style [zine](https://wizardzines.com/zines/http/) for sale that is really lovely as well.
92
-
:::
93
-
94
-
::: {.callout collapse=true}
95
-
#### There's a lovely poem from Rester Test [source](https://medium.com/@t79877005/api-response-codes-poem-451ca17e8f2c) that explains response codes and their meanings
96
-
97
-
```
98
-
In the world of tech, there’s a curious thing,
99
-
Called API requests that make devices sing.
100
-
They’re like little messages that devices send,
101
-
To get a response from their API friend.
102
-
103
-
API requests are like a note,
104
-
Sent to an API with a hopeful mote.
105
-
They can ask for data or do some work,
106
-
And wait for a response, like a playful quirk.
89
+
> 1xx Here's what I'll do.
90
+
2xx Here's what you want.
91
+
3xx I don't have what you want but I know who does.
92
+
4xx It didn't work but it's your fault.
93
+
5xx It didn't work and it's my fault.
107
94
108
-
But sometimes the API friend may say,
109
-
“I cannot do as you request today”.
110
-
And send a response with a special code,
111
-
To let the device know what’s on the road.
112
95
113
-
Response codes are like a language too,
114
-
And help devices know what to do.
115
-
There’s 200 for success, and 400 for bad,
116
-
And 500 for errors, that makes devices sad.
117
-
118
-
With response codes, the devices know,
119
-
If their requests are a friend or foe.
120
-
They can take action based on the code,
121
-
And keep the tech world in a secure mode.
122
-
123
-
So next time you send an API request,
124
-
And wait for a response with bated breath,
125
-
Remember that codes are the language they speak,
126
-
And help devices find what they seek.
127
-
128
-
API requests and response codes together,
129
-
Are the backbone of tech’s forever.
130
-
They help devices connect and communicate,
131
-
And make our world a much better state.
132
-
```
96
+
You can find a full list [here](https://www.coderstool.com/http-response-codes).
97
+
You're probably familiar with a 404 error, which is "File not found" -- that is, you passed in an address that isn't valid.
133
98
99
+
::: column-margin
100
+
Julia Evans [@evansQuestionsHTTPStatus2020] has some lovely Q&A flashcards on HTTP codes, and there is a cartoon-style [zine](https://wizardzines.com/zines/http/) for sale that is also very nice.
134
101
:::
135
102
136
-
137
103
## Accessing APIs without Authentication
138
104
139
105
:::: demo
@@ -234,13 +200,14 @@ Make sure you have the `httr2` library installed (it's a dependency of a lot of
# Animated and Interactive Graphics {#sec-interactive-graphics}
5
2
6
3
Interactive and animated graphics are one of the major advantages of using the `quarto` or `Rmarkdown` (or `Jupyter`) ecosystems - because you can easily create web pages in markdown (without the pain of HTML), you aren't limited by paper any more.
7
4
This chapter will focus on two different technologies that allow you to create different types of interactive charts, graphs, and interfaces: Shiny, and Plotly.
0 commit comments