Try It
Live from the API: three random coworkers. Reload, or hit the button.
Examples
JavaScript
const response = await fetch('https://dundermifflin.llc/api/people?department=accounting')
const accounting = await response.json()
for (const person of accounting) {
console.log(`${person.name} — ${person.title}`)
}cURL
# one person
curl https://dundermifflin.llc/api/people/pam-beesly
# a department, with its people
curl https://dundermifflin.llc/api/departments/warehouse
# four random coworkers from Scranton
curl "https://dundermifflin.llc/api/people/random?count=4&branch=scranton"
# just the total, without the bodies
curl -sI "https://dundermifflin.llc/api/people?department=sales" | grep -i x-total-countPython
import requests
people = requests.get("https://dundermifflin.llc/api/people", params={"q": "manager"}).json()
for person in people:
print(person["name"], "-", person["email"])React
import { useEffect, useState } from 'react'
export function TeamPreview() {
const [team, setTeam] = useState([])
useEffect(() => {
fetch('https://dundermifflin.llc/api/people/random?count=4')
.then((response) => response.json())
.then(setTeam)
}, [])
return (
<ul>
{team.map((person) => (
<li key={person.id}>
<img src={person.avatar} alt="" width="40" height="40" />
{person.name} — {person.title}
</li>
))}
</ul>
)
}Plain HTML
<!-- headshot by slug, no JSON needed -->
<img src="https://dundermifflin.llc/api/avatars/jim-halpert" alt="Jim Halpert" width="120" height="120">
<!-- group photo -->
<img src="https://dundermifflin.llc/api/photos/team-scranton.jpg" alt="The Scranton branch" width="400">Seeding a database
// seed a dev database with a believable team
const response = await fetch('https://dundermifflin.llc/api/people?limit=20')
const roster = await response.json()
await db.insert(users).values(
roster.map((person) => ({
name: person.name,
email: person.email,
role: person.title,
avatarUrl: person.avatar,
})),
)Full endpoint and parameter reference in the documentation.