How to create mock API for JSON data - DevOli/Marvel-chars GitHub Wiki

For implement the API, we use the platform “mockapi.io” to upload the JSON file example.

  1. First we need to create an account on the platform, or login with GitHub or Gmail:

  1. We need to create a New Project tapping the “Add Icon”

  1. For the basic setup, we set a Project Name and API Prefix

  1. At this point we define to use only a general endpoint, so it was necessary to create only one resource. The JSON example is just an Object, so we create a new resource of type Object and ID for default:

  1. With the new resource, we define the amount of Objects below the name with a slider, on this case just one, and edit the content tapping on Data button.

  1. Paste the JSON file example

  1. At this point we’ve got the API ready to use and test with postman, using the url and the name of the resource (endpoint):

URL: "https://619d463f131c600017088e71.mockapi.io/api/v1/characters"

  1. Last step, test the endpoint using Postman: