-
Notifications
You must be signed in to change notification settings - Fork 1
/
single-toot-api.html
39 lines (37 loc) · 1.18 KB
/
single-toot-api.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Testing Mastodon embeds</title>
<meta name="author" content="@[email protected]" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="keywords" content="mastodon, embed toot" />
<meta name="description" content="Example Mastodon embeds" />
<link rel="stylesheet" href="css/basic.css" />
<title>Mastodon simple API</title>
</head>
<body>
<div>
<h2>Calling the Mastodon API directly</h2>
</div>
<div>
This page is using <code>fetch()</code> in JavaScript, but you can try it with e.g. curl
<pre>$ curl https://mastodon.social/api/v1/statuses/108237453365199182</pre>
</div>
<div>
<strong>Result:</strong>
</div>
<div id="toot-content"></div>
<script>
let tootURL =
"https://mastodon.social/api/v1/statuses/108237453365199182";
fetch(tootURL)
.then((x) => x.json())
.then(
(y) =>
(document.getElementById("toot-content").innerHTML =
"<pre>" + JSON.stringify(y, null, 2) + "</pre>")
);
</script>
</body>
</html>