Exercise 1: GET REST API & Return Response Object

In this exercise, calculate two numbers through an API.

Requirements

  • The API should support the β€œGET” method.

  • Numbers should be passed as a β€œQuery String.”

  • Return the result with the error code β€œ200” in a JSON format: {"result": "The result of Addition"}

To proceed with the exercise, follow the steps below in the solution.

Note that on encountering text like the following: {username}, replace it with your user initials.

Solution

The solution consists of the following steps:

  • Create API

  • Test API.

Last updated