I am new to Django and created simple api which displays message using GET method
views.py:
@api_view(["GET"])
def message(request):
if request.method == 'GET':
return Response({"Print": "GET request from browser works"}, status=status. HTTP_200_OK)
urls.py:
from django.urls import path,include
from django.contrib.auth.models import User
from rest_framework import routers, serializers, viewsets
from . import views
urlpatterns = [
path('',views.index,name='Home'),
path('message',views.message,name='message'),
]
Now I want to take 2 inputs from user through url and perform addition on that inputs and return its result using GET and POST methods.
Example: http://127.0.0.1:8000/message/?a=2&b=3 (something like this) and it should return addition results.
Most of tutorials online are on fetching data from database but I want to create api which takes input from user and return its output.
Can anyone show me how to achieve above task?

request.query_paramsin your function to accessaandb.