MockShop API

MockShop API

Understanding Public API Documentation: Using

If you’re a software developer, you most likely have come across the term “API” or “Application Programming Interface” before. An API essentially allows two software applications to communicate with each other, using predefined rules and protocols. One of the best ways to learn how to use an API is by reading its documentation. In this blog post, we’ll explore the public API documentation for, a mock e-commerce website that allows developers to practice and test their API integration skills.

Getting Started with

First, you’ll need to sign up for a free account on to access the API. Once you’ve done that, you can find the API documentation at

The documentation clearly outlines the available endpoints, their corresponding request methods, and the expected response format. It also includes example request and response data, as well as code snippets to help you get started quickly.

Using API with JavaScript

Here are a few example code snippets in JavaScript that demonstrate how to use API:

Example 1: Retrieving a List of Products

To fetch the list of available products, you can send a GET request to the /products endpoint. Here’s how you can do it using fetch API in JavaScript:

  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

This will log the list of products to the console.

Example 2: Retrieving Details of a Specific Product

To fetch the details of a specific product, you can send a GET request to the /products/{productId} endpoint. Here’s how you can do it using axios in JavaScript:

  .then(response => console.log(
  .catch(error => console.error(error));

This will log the details of the product with ID 123 to the console.

Example 3: Creating a New Order

To create a new order, you can send a POST request to the /orders endpoint with the relevant order data. Here’s an example using fetch API:

const data = {
  customerName: 'John Doe',
  email: '',
  phoneNumber: '1234567890',
  items: [
    { productId: 1, quantity: 2 },
    { productId: 2, quantity: 1 }

fetch('', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  body: JSON.stringify(data)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));

This will create a new order with the specified data and log the response to the console.


API documentation is an essential resource for any developer who wants to integrate with a third-party API. The API documentation is comprehensive and user-friendly, making it easy to get started with integrating the API into your application. By following the examples provided in this blog post, you should be able to start experimenting with the API and building your own integrations.