Specra Format Example

Live API example using Specra format with JSONPlaceholder

This page demonstrates the <ApiReference> component using a real public API (JSONPlaceholder).

All endpoints below are fully functional and can be tested using the interactive playground!

Info
This API is free and requires no authentication. Perfect for testing!

Loading API specification...


Try It Yourself

  1. Expand any endpoint by clicking on it
  2. Scroll to the playground at the bottom of each endpoint
  3. Click "Send Request" to test the API live
  4. View the response in the JSON viewer

About JSONPlaceholder

JSONPlaceholder is a free fake REST API for testing and prototyping. It's perfect for:

  • Testing API documentation tools (like this!)
  • Frontend development
  • Learning HTTP methods
  • Prototyping applications
Pro Tip
Try modifying the request body in the POST/PUT/PATCH endpoints and see the response change!

Example Integration

Here's how you might use this API in a real application:

Code
javascript
1// Fetch all posts
2async function getPosts() {
3 const response = await fetch('https://jsonplaceholder.typicode.com/posts?_limit=5');
4 const posts = await response.json();
5 return posts;
6}
7 
8// Create a new post
9async function createPost(title, body) {
10 const response = await fetch('https://jsonplaceholder.typicode.com/posts', {
11 method: 'POST',
12 headers: { 'Content-Type': 'application/json' },
13 body: JSON.stringify({
14 title,
15 body,
16 userId: 1
17 })
18 });
19 return await response.json();
20}
21 
22// Usage
23const posts = await getPosts();
24console.log(posts);
25 
26const newPost = await createPost('My Title', 'My Content');
27console.log(newPost);

Next Steps