Mock REQUEST Bodies to Accelerate API Debugging

This article discusses the benefits of using a tool that automatically generates request bodies for API debugging. It highlights the importance of having good tools to maintain code quality and how this tool can help construct a correct request JSON for debugging.

Ismail Kamil

Ismail Kamil

31 July 2025

Mock REQUEST Bodies to Accelerate API Debugging

When developing APIs, debugging is always a boring problem.

Postman can help send requests, but when the API body is complicated, constructing a JSON body would be difficult. Junit also works, but all requests must be constructed yourself in testing classes.

Complex bodies make many backends abandon unit tests and output an untested API to frontend developers and QA engineers.

The above case demonstrates that the code quality declines without a good tool. And now, there is a useful tool named Apidog that can generate the request body automatically when debugging. The tool can construct a correct request JSON itself.

How to Mock Request Bodies

This approach works for API-first teams. APIs are designed before developing, so while debugging, you have an API specification.

1. Import the API specifications into Apidog. (How to Mock An API? )
2. Open an API, and make sure the request has a JSON/XML body specification.

Image Description

3. Switch to the "Run" tab, and click the "Generate Automatically" button. You've got a mock JSON according to the request specification!

Image description

And now click "send" to send the request like what you did in Postman, but more efficiently. Most features in Postman are also supported in Apidog. Our team has used Apidog to debug APIs instead of Postman for weeks.

What's More

Notice the mock data. It was generated automatically according to the field name. A field named "city" are mocked with a city name, a field named photo URL is mocked with a photo URL, and all mock data follows JSON schema specified in the API. Just like the previous article: How to mock complex JSON.

And that's not the end. Hover on the arrow beside "Generate Automatically", and you'll see three menu items.

Mock Menu Items

"Default value first" means the mock JSON would be filled by the default value specified in each field of the API first. "Example value first" means the mock JSON would be loaded by the example request JSON first. But what is "Refresh when sending request"?

It's just the literal meaning. Each time the request is sent, the body is generated again.

How to Customize Request Bodies

Until now, everything looks great. But what if some of my fields are not expected to change? How can I make some fields fixed and some mocked?

Click the "Dynamic Value" button, and you'll find a new world.

Image description

All Faker.js syntaxes are supported, and you can select any of them directly. You can even select a function to mutate the mock value like md5, substrate or base64, etc.
Then it will be inserted into the request body, just like this.

Request Bodies

You can decide which field is fixed and which is mocked by Faker.js. When sent, all faker fields will change to the actual data below.

Set up Params

That's it. And it changes each time sending. Apidog is a great tool that makes our team build APIs faster.

Explore more

How to Use Claude Opus 4.1 for Free in 2025

How to Use Claude Opus 4.1 for Free in 2025

Discover how to access Claude Opus 4.1 for free via the claude.ai interface. Anthropic offers 3 standard requests and 3 extended thinking requests until September 15, 2025. This guide provides step-by-step instructions for signup, usage optimization, and practical tips for AI enthusiasts.

13 September 2025

How to create and edit files with Claude ?

How to create and edit files with Claude ?

Explore how Claude AI enables users to create and edit files such as Excel spreadsheets, Word documents, and PDFs through its advanced features. This technical guide covers activation steps, practical examples, API integrations, and best practices.

12 September 2025

What's Seedream 4.0 and How Do You Access Its API?

What's Seedream 4.0 and How Do You Access Its API?

ByteDance's Seedream 4.0 tops AI image editing leaderboards with superior generation and editing. Developers access its API via BytePlus, fal.ai, and more for high-res outputs. Use Apidog to test and integrate effortlessly—download free today for streamlined API workflows.

12 September 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs