Free Public APIs for Frontend Testing
JSONPlaceholder
JSONPlaceholder offers a fully functional REST API for testing and prototyping. It supports standard HTTP methods along with filtering and pagination capabilities.
Fetching Post Collections
Retrieve a list of 100 posts. Each object contains identifiers, title, and body.
const fetchAllPosts = async () => {
const res = await fetch('https://placeholder.typicode.com/posts');
return res.();
};Retrieving a Specific Post
Fetch a single post by appending its identifier to the endpoint.
const targetPostId = 2;
const postRes = await fetch(`https://placeholder.typicode.com/posts/${targetPostId}`);
const postData = await postRes.();Creating a Post
Submit a POST request to generate a new post. A successful response returns the newly created resource identifier.
const createNewPost = async () => {
const response = await fetch('https://placeholder.typicode.com/posts', {
method: 'POST',
headers: { 'Content-Type': 'application/' },
body: JSON.stringify({
authorId: 11,
postTitle: 'API Testing',
postBody: 'Content goes here'
})
});
return response.();
};Available Resources
- Posts: /posts, /posts/{id}, /posts?userId={userId}, /posts/{id}/comments
- Comments: /comments, /comments?postId={postId}
- Albums: /albums, /albums/{id}, /albums?userId={userId}
- Todos: /todos, /todos/{id}, /todos?userId={userId}
- Users: /users, /users/{id}
- Photos: /photos, /photos/{id}
The Cat API
This service provides feline images and supports operations like breed filtering, category search, pagination, and image analysis.
Retrieving Random Cat Images
Fetch a random cat image. The limit parameter controls the number of returned results.
const fetchLimit = 1;
const catUrl = `https://api.thecatapi.com/v1/images/search?limit=${fetchLimit}`;
const catData = await (await fetch(catUrl)).();Dog API
A straightforward API for fetching random canine images.
Fetching a Random Dog Image
const dogImgEndpoint = 'https://dog.ceo/api/breeds/image/random';
const dogResult = await (await fetch(dogImgEndpoint)).();Lorem Picsum
Generates placeholder images with customizable dimensions. The response is a direct image resource, making it suitable for use within the src attribute of an <img> tag.
Specifying Image Dimensions
To retrieve a square image, provide a single dimension value (e.g., 200x200 pixels).
<img src="https://picsum.photos/200" alt="Square Placeholder" />For rectangular dimensions, supply both width and height.
<img src="https://picsum.photos/200/300" alt="Rectangular Placeholder" />Miscellaneous Public APIs
Video Platform Episode Listing (IQiyi)
Fetches episode lists for a given series identifier and page number.
const seriesId = 202861101;
const pageNum = 1;
const episodeApi = `https://cache.video.iqiyi.com/jp/avlist/${seriesId}/${pageNum}/`;Response fields include vpic (cover image), shortTitle (episode number), vt (episode name), vid (video identifier), and vur (playback URL).
Shipment Tracking (Kuaidi100)
Queries delivery status by carrier code and tracking number.
const carrierCode = 'shunfeng';
const trackingNum = 'SF1234567890';
const trackingApi = `http://www.kuaidi100.com/query?type=${carrierCode}&postid=${trackingNum}`;Supported carrier codes:
- Shentong:
shentong - EMS:
ems - Shunfeng:
shunfeng - Yuantong:
yuantong - Zhongtong:
zhongtong - Yunda:
yunda - Tiantian:
tiantian - Huitong:
huitongkuaidi - Quanfeng:
quanfengkuaidi - Debang:
debangwuliu - Zhaijisong:
zhaijisong
Product Search Suggestions (Taobao)
Returns product suggestions based on a keyword, with JSONP support via a callback parameter.
const searchKeyword = 'laptop';
const pCallback = 'handleSuggestions';
const suggestApi = `http://suggest.taobao.com/sug?code=utf-8&q=${searchKeyword}&callback=${pCallback}`;