javascriptjsonreactjsrestfrontend

A REST API to echo same JSON data back for testing purposes


I am currently developing a front-end app with React. During the development, I create some objects and use them to render test data. The app is intended to work with a Spring Boot application on the server side. I have performed certain tests to ensure communication between front and back end before, however to simplify my development process I thought about using a RESTful API (that is ideally available online as a free testing service) where I would send JSON objects and receive the same object back.

I realize that this sounds counter-intuitive, but here is my reasoning:

So the point is not exactly the data we fetch, but the way we fetch it. Currently I won't be working with our own back-end application since it is just too bloated/incomplete to work with. Using publicly available test APIs with their predetermined data types seems infeasible, because I happen to work with a specific data type that has a lot of custom and necessary fields.

I made some quick searching, but couldn't find an API like that. I could create a fast REST API locally, but that would be far from ideal in my case given that on a realistic scenario I'll have the delay and slightly different asynchronous nature of network interaction, not to mention CORS related configurations etc.

To be short, my question is as follows:

Is it a known practice to use such API's that receives POST requests and responds same objects back (although it sounds weird)? Is there any service that you could recommend for me to use?

Thanks in advance.


Solution

  • There are Postman echo APIs to do exactly the same.

    The API echoes back what you sent it, including each of the data items you included in the request as part of the response postman-echo.com/get, postman-echo.com/post etc.

    Please check this link for more details learning.postman.com/docs/developer/echo-api

    And about this part of the question : "Is it a known practice to use such API's that receives POST requests and responds same objects back?"
    Yes we do this to test the code using these echo APIs. All these are based on the requirements of the problem at hand.