-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart.sh
More file actions
executable file
·43 lines (33 loc) · 1.28 KB
/
Copy pathquickstart.sh
File metadata and controls
executable file
·43 lines (33 loc) · 1.28 KB
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
40
41
42
43
#!/bin/bash
# quickstart.sh — thredly API quickstart examples
# Usage: THREDLY_API_KEY=your-api-key bash examples/curl/quickstart.sh
set -euo pipefail
API_KEY="${THREDLY_API_KEY:-your-api-key}"
BASE="https://thredly.dev/api"
echo "=== thredly API Quickstart ==="
echo ""
# 1. Get user info (resolve username → userId)
echo "--- 1. Get user info for @zuck ---"
curl -s -H "x-api-key: $API_KEY" "$BASE/user/info?username=zuck" | head -c 500
echo -e "\n"
# 2. Get user posts (replace 12345 with a real userId from step 1)
echo "--- 2. Get user posts ---"
curl -s -H "x-api-key: $API_KEY" "$BASE/user/12345/posts" | head -c 500
echo -e "\n"
# 3. Get a specific post
echo "--- 3. Get post details ---"
curl -s -H "x-api-key: $API_KEY" "$BASE/post/C1234567890" | head -c 500
echo -e "\n"
# 4. Search top results
echo "--- 4. Search top results ---"
curl -s -H "x-api-key: $API_KEY" "$BASE/search/top?q=threads" | head -c 500
echo -e "\n"
# 5. Search recent results
echo "--- 5. Search recent results ---"
curl -s -H "x-api-key: $API_KEY" "$BASE/search/recent?q=AI" | head -c 500
echo -e "\n"
# 6. Search profiles
echo "--- 6. Search profiles ---"
curl -s -H "x-api-key: $API_KEY" "$BASE/search/profiles?q=researcher" | head -c 500
echo -e "\n"
echo "=== Done. Get your API key at https://thredly.dev ==="