Practice making API requests before building your own backend
Use these endpoints to practice making HTTP requests. The base URL is: https://aw.profbobby.com/api/
Search programming resources. Returns JSON data.
Query Parameters:
q - Search query (searches titles, descriptions, and tags)category - Filter by category (documentation, tutorial, tool, game, api)tag - Filter by tag (javascript, css, react, etc.)Examples:
GET /api/search
GET /api/search?q=javascript
GET /api/search?category=tutorial
GET /api/search?tag=css
Get all messages from the message board.
Query Parameters:
limit - Maximum number of messages to return (default: 50, max: 100)GET /api/messages
GET /api/messages?limit=10
Create a new message on the message board.
Request Body (JSON):
{
"username": "your_name",
"message": "your_message"
}
Or Form Data:
username=your_name&message=your_message
Delete a message by ID.
DELETE /api/messages?id=123
Search our database of programming resources.
Post a message to the class message board.
Messages posted by you and your classmates:
// GET Request - Search for resources
fetch('/api/search?q=javascript')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
// POST Request - Create a message
fetch('/api/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'StudentName',
message: 'Hello from JavaScript!'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<form action="/api/messages" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
<button type="submit">Post Message</button>
</form>
// Modern async/await syntax
async function searchResources(query) {
try {
const response = await fetch(`/api/search?q=${query}`);
const data = await response.json();
if (data.success) {
console.log(`Found ${data.count} results:`);
data.results.forEach(item => {
console.log(`- ${item.title}: ${item.url}`);
});
}
} catch (error) {
console.error('Failed to fetch:', error);
}
}
// Call the function
searchResources('react');