I want to pass url parameters in this format http://localhost:8000/api/projects/?id=2021&a=2&b=3&c=4 and get the values in view function
Asked
Active
Viewed 106 times
-2
-
Does this answer your question? [Capturing URL parameters in request.GET](https://stackoverflow.com/questions/150505/capturing-url-parameters-in-request-get) – Clepsyd Nov 21 '22 at 03:01
-
See https://stackoverflow.com/questions/150505/capturing-url-parameters-in-request-get and https://stackoverflow.com/questions/48299466/django-rest-framework-passing-parameters-with-get-request-classed-based-views – Clepsyd Nov 21 '22 at 03:02
1 Answers
0
In DRF you can get values of perms like this...
URL = http://localhost:8000/api/projects/?id=2021&a=2&b=3&c=4
id = request.query_params.get('id')
a = request.query_params.get('a')
b = request.query_params.get('b')
c = request.query_params.get('c')
print(id,a,b,c)
Postman Screen

Mahammadhusain kadiwala
- 2,693
- 2
- 4
- 12