# 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.&#x20;
* Numbers should be passed as a “Query String.”&#x20;
* Return the result with the error code “200” in a JSON format: \
  `{"result": "The result of Addition"}`

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_4/ch4ex1calcflow.png>" %}

To proceed with the exercise, follow the steps below in the solution.&#x20;

{% hint style="info" %}
Note that on encountering text like the following: {username}, replace it with your user initials.
{% endhint %}

## Solution

The solution consists of the following steps:

* Create API
* Test API.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.langstack.com/welcome/get-started/learn-langstack/introduction-to-rest-api/exercise-1-get-rest-api-and-return-response-object.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
